﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Collections;
using SAC.Helper;
using DAL;
namespace BLL
{
    public class BLLRep
    {
        static string xzTime = "2012-1-1";     //取值限制时间
        static string toExcel = "yse";         //导出Excel是否控制小数点
        string rtDBType = "";   //实时数据库
        string rlDBType = "";   //关系数据库

        DALRep dr = new DALRep();
        DALReport drp = new DALReport();
        ArrayList list = new ArrayList();
        StringBuilder sb = new StringBuilder();
        StrHelper sh = new StrHelper();
        DALUtilityMehtod um = new DALUtilityMehtod();

        /// <summary>
        /// 构造函数
        /// </summary>
        static BLLRep()
        {

            ///br.rtDBType = IniHelper.ReadIniData("RelationDBbase", "DBType", null);
        }

        /// <summary>
        /// 初始化函数
        /// </summary>
        private void init()
        {
            if (IniHelper.ReadIniData("Report", "XZTime", null) != "")
                xzTime = IniHelper.ReadIniData("Report", "XZTime", null);

            if (IniHelper.ReadIniData("Report", "Excle", null) != "")
                toExcel = IniHelper.ReadIniData("Report", "Excle", null);
        }

        /// <summary>
        /// 值报
        /// </summary>
        /// <param name="repName"></param>
        /// <param name="date"></param>
        /// <param name="unit"></param>
        /// <param name="repType"></param>
        /// <returns></returns>
        public string RetTableByVal(string repName, string date, int unit, string repType)
        {
            string[] arr;
            string[] arrBZ = null;
            string[] tjxsBZ = null;

            string qsrq = "";
            string jsrq = "";
            string bzID = "";
            string bName = "";
            string bzTime = "";

            DateTime dtNow = DateTime.Now;

            this.init();

            if (Convert.ToDateTime(date) > dtNow || Convert.ToDateTime(date) < Convert.ToDateTime(xzTime))
            { sb.Append("请选择正确日期进行查询......"); return sb.ToString(); }

            DataTable dtXZ = dr.RetTableXZ(unit.ToString(), repName);

            if (repType == "日值")
            {
                bName = "统计数据值日表";

                date = DateTime.Parse(date).ToString("yyyy-MM-dd 0:00:00");

                list = drp.RetArrsRepVal(repName, date, bName, out bzID, out bzTime);

                if (bzTime.Contains(';'))
                {
                    string bz = bzTime.TrimEnd(';');

                    string[] bzsj = bz.Split(';');

                    tjxsBZ = new string[3];

                    for (int i = 0; i < bzsj.Length; i++)
                    {
                        string[] sj = bzsj[i].Split(',');

                        qsrq = sj[0].ToString();
                        jsrq = sj[1].ToString();

                        tjxsBZ[i] = um.tjxs(qsrq, jsrq, unit);
                    }
                }
            }
            else if (repType == "月值")
            {
                bName = "统计数据值月表";
            }
            else if (repType == "年值")
            {
                bName = "统计数据值年表";
            }
            else if (repType == "季值")
            {
                bName = "统计数据值季表";
            }

            string[] zb = (string[])list[0];
            string[] un = (string[])list[1];
            string[] lay = (string[])list[2];
            string[] dv = (string[])list[3];
            string[] dvExcel = (string[])list[4];

            if (list.Count > 0)
            {
                if (bzID.Contains(';'))
                {
                    string bz = bzID.TrimEnd(';');

                    arrBZ = bz.Split(';');
                }

                if (toExcel == "yes")
                    sb.Append("<table width=\"90%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX\">");
                else
                    sb.Append("<table width=\"90%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX1\">");

                sb.Append(" <tr style='width: 80%;' bgcolor='#CFE6FC'>");

                sb.Append("<td style='width: 20%;'> <div align='center'> 指 标 名 称 </td>");

                sb.Append("<td style='width: 10%;'> <div align='center'> 单 位 </td>");

                sb.Append("<td style='width: 10%;'><div align='center'> 设计值 </td>");

                for (int i = 0; i < arrBZ.Length; i++)
                { sb.AppendFormat("<td style='width: 10%;'><div align='center'>{0}</td>", sh.ConvertChinese(arrBZ[i].TrimEnd())); }

                sb.Append(" </tr>");

                for (int i = 1; i < zb.Length; i++)
                {
                    sb.Append("<tr>");

                    sb.AppendFormat("<td align='center'>{0}</td>", zb[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", un[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", lay[i]);

                    if (dv[i] != null)
                    {
                        string[] arr1 = dv[i].ToString().Split(';');
                        //#2
                        string str = arr1[1].ToString();

                        string[] arrBZ1 = str.Split(',');

                        for (int j = 0; j < arrBZ1.Length; j++)
                        {
                            string[] arrValue = arrBZ1[j].ToString().Split('+');

                            sb.AppendFormat("<td align='center'>{0}</td>", arrValue[1]);
                        }
                    }
                    ////累计类型和电量类型不做判断
                    //if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "累计" || dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                    //{
                    //    if (dv[i] != null)
                    //    {
                    //        arr = dv[i].Split(',');

                    //        if (arrBZ.Length > (arr.Length - 1) || arrBZ.Length == (arr.Length - 1))
                    //        {
                    //            int a = arrBZ.Length - (arr.Length - 1);

                    //            for (int j = 0; j < arr.Length - 1; j++)
                    //                sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());

                    //            for (int j = 0; j < a; j++)
                    //                sb.AppendFormat("<td align='center'>0</td>");
                    //        }
                    //    }
                    //}
                    //else
                    //{
                    //    if (repName == "厂用电报表")
                    //    {
                    //        if (dv[i] != null)
                    //        {
                    //            arr = dv[i].Split(',');

                    //            if (arrBZ.Length > (arr.Length - 1) || arrBZ.Length == (arr.Length - 1))
                    //            {
                    //                int a = arrBZ.Length - (arr.Length - 1);

                    //                for (int j = 0; j < arr.Length - 1; j++)
                    //                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());

                    //                for (int j = 0; j < a; j++)
                    //                    sb.AppendFormat("<td align='center'>0</td>");
                    //            }
                    //        }
                    //    }
                    //    else if (repName == "汽机报表" || repName == "锅炉报表")
                    //    {
                    //        if (dv[i] != null)
                    //        {
                    //            arr = dv[i].Split(',');

                    //            if (arrBZ.Length > (arr.Length - 1) || arrBZ.Length == (arr.Length - 1))
                    //            {
                    //                int a = arrBZ.Length - (arr.Length - 1);

                    //                for (int j = 0; j < arr.Length - 1; j++)
                    //                {
                    //                    if (tjxsBZ[j] != "0")
                    //                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                    //                    else
                    //                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                    //                }

                    //                for (int j = 0; j < a; j++)
                    //                {
                    //                    sb.AppendFormat("<td align='center'>0</td>");
                    //                }
                    //            }
                    //        }
                    //    }
                    //    else
                    //    {
                    //        if (dv[i] != null)
                    //        {
                    //            arr = dv[i].Split(',');

                    //            if (arrBZ.Length > (arr.Length - 1) || arrBZ.Length == (arr.Length - 1))
                    //            {
                    //                int a = arrBZ.Length - (arr.Length - 1);

                    //                if (i <= 10)
                    //                {
                    //                    for (int j = 0; j < arr.Length - 1; j++)
                    //                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());

                    //                    for (int j = 0; j < a; j++)
                    //                        sb.AppendFormat("<td align='center'>0</td>");
                    //                }
                    //                else
                    //                {
                    //                    for (int j = 0; j < arr.Length - 1; j++)
                    //                    {
                    //                        if (tjxsBZ[j] != "0")
                    //                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                    //                        else
                    //                            sb.AppendFormat("<td align='center'>{0}</td>", "0");
                    //                    }

                    //                    for (int j = 0; j < a; j++)
                    //                    {
                    //                        sb.AppendFormat("<td align='center'>0</td>");
                    //                    }
                    //                }
                    //            }
                    //        }
                    //    }
                    //}
                }
                sb.Append("</table>");

                #region 导出Excel表
                if (toExcel == "no")
                    sb.Append("<table width=\"90%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX\" style=\"display:none;\">");
                else
                    sb.Append("<table width=\"90%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX1\" style=\"display:none;\">");

                sb.Append(" <tr style='width: 80%;' bgcolor='#CFE6FC'>");

                sb.Append("<td style='width: 20%;'> <div align='center'> 指 标 名 称 </td>");

                sb.Append("<td style='width: 10%;'> <div align='center'> 单 位 </td>");

                sb.Append("<td style='width: 10%;'><div align='center'> 设计值 </td>");

                for (int i = 0; i < arrBZ.Length; i++)
                { sb.AppendFormat("<td style='width: 10%;'><div align='center'>{0}</td>", sh.ConvertChinese(arrBZ[i].TrimEnd())); }

                sb.Append(" </tr>");

                for (int i = 1; i < zb.Length; i++)
                {
                    sb.Append("<tr>");

                    sb.AppendFormat("<td align='center'>{0}</td>", zb[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", un[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", lay[i]);

                    //累计类型和电量类型不做判断
                    if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "累计" || dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                    {
                        if (dvExcel[i] != null)
                        {
                            arr = dvExcel[i].Split(',');

                            if (arrBZ.Length > (arr.Length - 1) || arrBZ.Length == (arr.Length - 1))
                            {
                                int a = arrBZ.Length - (arr.Length - 1);

                                for (int j = 0; j < arr.Length - 1; j++)
                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());

                                for (int j = 0; j < a; j++)
                                    sb.AppendFormat("<td align='center'>0</td>");
                            }
                        }
                    }
                    else
                    {
                        if (repName == "厂用电报表")
                        {
                            if (dvExcel[i] != null)
                            {
                                arr = dvExcel[i].Split(',');

                                if (arrBZ.Length > (arr.Length - 1) || arrBZ.Length == (arr.Length - 1))
                                {
                                    int a = arrBZ.Length - (arr.Length - 1);

                                    for (int j = 0; j < arr.Length - 1; j++)
                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());

                                    for (int j = 0; j < a; j++)
                                        sb.AppendFormat("<td align='center'>0</td>");
                                }
                            }
                        }
                        else if (repName == "汽机报表" || repName == "锅炉报表")
                        {
                            if (dvExcel[i] != null)
                            {
                                arr = dvExcel[i].Split(',');

                                if (arrBZ.Length > (arr.Length - 1) || arrBZ.Length == (arr.Length - 1))
                                {
                                    int a = arrBZ.Length - (arr.Length - 1);

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (tjxsBZ[j] != "0")
                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                    }

                                    for (int j = 0; j < a; j++)
                                    {
                                        sb.AppendFormat("<td align='center'>0</td>");
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (dvExcel[i] != null)
                            {
                                arr = dvExcel[i].Split(',');

                                if (arrBZ.Length > (arr.Length - 1) || arrBZ.Length == (arr.Length - 1))
                                {
                                    int a = arrBZ.Length - (arr.Length - 1);

                                    if (i <= 10)
                                    {
                                        for (int j = 0; j < arr.Length - 1; j++)
                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());

                                        for (int j = 0; j < a; j++)
                                            sb.AppendFormat("<td align='center'>0</td>");
                                    }
                                    else
                                    {
                                        for (int j = 0; j < arr.Length - 1; j++)
                                        {
                                            if (tjxsBZ[j] != "0")
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                        }

                                        for (int j = 0; j < a; j++)
                                        {
                                            sb.AppendFormat("<td align='center'>0</td>");
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                sb.Append("</table>");

                #endregion
            }
            return sb.ToString();
        }

        /// <summary>
        /// 日报(机组轮转)
        /// </summary>
        /// <param name="repName"></param>
        /// <param name="date"></param>
        /// <returns></returns>
        public string RetTableByDay(string repName, string repType, DateTime date)
        {
            string[] arr;
            string qsrq;
            string jsrq;
            string tjxsA;
            string tjxsB;

            bool isTure = false;

            DateTime dtNow = DateTime.Now;

            this.init();

            if (date < dtNow && date >= Convert.ToDateTime(xzTime))
            {
                if (dtNow.Year == date.Year && dtNow.Month == date.Month && dtNow.Day == date.Day)
                {
                    qsrq = date.ToString("yyyy-MM-dd 00:00:00");
                    jsrq = dtNow.AddHours(-1).ToString("yyyy-MM-dd H:00:00");
                    isTure = true;
                }
                else
                {
                    qsrq = date.ToString("yyyy-MM-dd H:mm:ss");
                    jsrq = date.AddDays(+1).ToString("yyyy-MM-dd H:mm:ss");
                }
            }
            else
            { sb.Append("请输入正确的日期进行查询......"); return sb.ToString(); }

            if (repType == "日报")
            { repType = "日点"; }

            tjxsA = um.tjxs(qsrq, jsrq, 1);
            tjxsB = um.tjxs(qsrq, jsrq, 2);

            //list = dr.RetArrsRepDay(repName, repType, qsrq, jsrq, isTure);

            list = drp.RetArrsRepDay(repName, repType, qsrq, jsrq, isTure);

            DataTable dtXZ = dr.RetTableXZ("1", repName);

            string[] zb = (string[])list[0];//指标名称
            string[] un = (string[])list[1];//单位
            string[] lay = (string[])list[2];//设计值
            string[] dv = (string[])list[3];//值
            string[] dvExcel = (string[])list[4];//原始值

            if (list.Count > 0)
            {
                if (toExcel == "yes")
                    sb.Append("<table width=\"90%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX\">");
                else
                    sb.Append("<table width=\"90%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX1\">");

                sb.Append("<tr style=\"width: 80%;\" bgcolor=\"#CFE6FC\"> ");
                sb.Append("<td style=\"width: 20%;\"><div align=\"center\">指 标 名 称</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">单 位</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">设计值</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">#1机</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">#2机</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">全厂</td>");
                sb.Append("</tr>");

                for (int i = 1; i < zb.Length; i++)
                {
                    sb.Append("<tr>");

                    sb.AppendFormat("<td align='center'>{0}</td>", zb[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", un[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", lay[i]);

                    if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "累计" || dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                    {
                        if (dv[i] != null)
                        {
                            if (dv[i].TrimEnd(',').Contains(','))
                            {
                                arr = dv[i].Split(',');

                                for (int j = 0; j < arr.Length - 1; j++)
                                {
                                    if (arr[j] != null)
                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                }
                            }
                        }
                    }
                    else
                    {
                        if (repName == "厂用电报表")
                        {
                            if (dv[i] != null)
                            {
                                if (dv[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dv[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (zb[i] == "输煤单耗" || zb[i] == "输煤设备电率")
                                        { sb.AppendFormat("<td align='center'>{0}</td>", "0"); }
                                        else
                                        {
                                            if (arr[j] != null)
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                    }
                                }
                            }
                        }
                        else if (repName == "汽机报表" || repName == "锅炉报表")
                        {
                            if (dv[i] != null)
                            {
                                if (dv[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dv[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (j == 0)
                                            {
                                                if (tjxsA == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else if (j == 1)
                                            {
                                                if (tjxsB == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (dv[i] != null)
                            {
                                if (dv[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dv[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (i <= 10)
                                            { sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString()); }
                                            else
                                            {
                                                if (j == 0)
                                                {
                                                    if (tjxsA == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else if (j == 1)
                                                {
                                                    if (tjxsB == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }
                        }
                        sb.Append("</tr>");
                    }
                }

                sb.Append("</table>");

                #region 导出Excel表
                if (toExcel == "no")
                    sb.Append("<table width=\"90%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX\" style=\"display:none;\">");
                else
                    sb.Append("<table width=\"90%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX1\" style=\"display:none;\">");

                sb.Append("<tr style=\"width: 80%;\" bgcolor=\"#CFE6FC\"> ");
                sb.Append("<td style=\"width: 20%;\"><div align=\"center\">指 标 名 称</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">单 位</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">设计值</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">#1机</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">#2机</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">全厂</td>");
                sb.Append("</tr>");

                for (int i = 1; i < zb.Length; i++)
                {
                    sb.Append("<tr>");

                    sb.AppendFormat("<td align='center'>{0}</td>", zb[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", un[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", lay[i]);

                    if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "累计" || dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                    {
                        if (dvExcel[i] != null)
                        {
                            if (dvExcel[i].TrimEnd(',').Contains(','))
                            {
                                arr = dvExcel[i].Split(',');

                                for (int j = 0; j < arr.Length - 1; j++)
                                {
                                    if (arr[j] != null)
                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                }
                            }
                        }
                    }
                    else
                    {
                        if (repName == "厂用电报表")
                        {
                            if (dvExcel[i] != null)
                            {
                                if (dvExcel[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcel[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }
                        }
                        else if (repName == "汽机报表" || repName == "锅炉报表")
                        {
                            if (dvExcel[i] != null)
                            {
                                if (dvExcel[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcel[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (j == 0)
                                            {
                                                if (tjxsA == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else if (j == 1)
                                            {
                                                if (tjxsB == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (dvExcel[i] != null)
                            {
                                if (dvExcel[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcel[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (i <= 10)
                                            { sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString()); }
                                            else
                                            {
                                                if (j == 0)
                                                {
                                                    if (tjxsA == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else if (j == 1)
                                                {
                                                    if (tjxsB == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }
                        }
                        sb.Append("</tr>");
                    }
                }

                sb.Append("</table>");
                #endregion
            }
            else
            { sb.Append("没有查询到结果..."); return sb.ToString(); }

            return sb.ToString();
        }

        /// <summary>
        /// 日报(机组轮转)
        /// 任意时间段数据查询
        /// </summary>
        /// <param name="repName"></param>
        /// <param name="date"></param>
        /// <returns></returns>
        public string RetTableByDay(string repName, string repType, string qsrq, string jsrq)
        {
            string[] arr;
            string tjxsA;
            string tjxsB;

            bool isTure = false;

            DateTime dtNow = DateTime.Now;

            this.init();

            if (DateTime.Parse(jsrq) > dtNow)
                jsrq = dtNow.AddHours(-1).ToString("yyyy-MM-dd H:00:00");

            if (DateTime.Parse(qsrq) > DateTime.Parse(jsrq) || DateTime.Parse(qsrq) == DateTime.Parse(jsrq))
            { sb.Append("请输入正确的日期进行查询......"); return sb.ToString(); }

            if (repType == "日报")
            { repType = "日点"; }

            tjxsA = um.tjxs(qsrq, jsrq, 1);
            tjxsB = um.tjxs(qsrq, jsrq, 2);

            //list = dr.RetArrsRepDay(repName, repType, qsrq, jsrq, isTure);

            list = drp.RetArrsRepDay(repName, repType, qsrq, jsrq, isTure);

            DataTable dtXZ = dr.RetTableXZ("1", repName);

            string[] zb = (string[])list[0];
            string[] un = (string[])list[1];
            string[] lay = (string[])list[2];
            string[] dv = (string[])list[3];
            string[] dvExcel = (string[])list[4];

            if (list.Count > 0)
            {
                if (toExcel == "yes")
                    sb.Append("<table width=\"90%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX\">");
                else
                    sb.Append("<table width=\"90%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX1\">");

                sb.Append("<tr style=\"width: 80%;\" bgcolor=\"#CFE6FC\"> ");
                sb.Append("<td style=\"width: 20%;\"><div align=\"center\">指 标 名 称</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">单 位</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">设计值</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">#1机</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">#2机</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">全厂</td>");
                sb.Append("</tr>");

                for (int i = 1; i < zb.Length; i++)
                {
                    sb.Append("<tr>");

                    sb.AppendFormat("<td align='center'>{0}</td>", zb[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", un[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", lay[i]);

                    if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "累计" || dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                    {
                        if (dv[i] != null)
                        {
                            if (dv[i].TrimEnd(',').Contains(','))
                            {
                                arr = dv[i].Split(',');

                                for (int j = 0; j < arr.Length - 1; j++)
                                {
                                    if (arr[j] != null)
                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                }
                            }
                        }
                    }
                    else
                    {
                        if (repName == "厂用电报表")
                        {
                            if (dv[i] != null)
                            {
                                if (dv[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dv[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (zb[i] == "输煤单耗" || zb[i] == "输煤设备电率")
                                        { sb.AppendFormat("<td align='center'>{0}</td>", "0"); }
                                        else
                                        {
                                            if (arr[j] != null)
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                    }
                                }
                            }
                        }
                        else if (repName == "汽机报表" || repName == "锅炉报表")
                        {
                            if (dv[i] != null)
                            {
                                if (dv[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dv[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (j == 0)
                                            {
                                                if (tjxsA == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else if (j == 1)
                                            {
                                                if (tjxsB == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (dv[i] != null)
                            {
                                if (dv[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dv[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (i <= 10)
                                            { sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString()); }
                                            else
                                            {
                                                if (j == 0)
                                                {
                                                    if (tjxsA == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else if (j == 1)
                                                {
                                                    if (tjxsB == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }
                        }
                        sb.Append("</tr>");
                    }
                }

                sb.Append("</table>");

                #region 导出Excel表
                if (toExcel == "no")
                    sb.Append("<table width=\"90%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX\" style=\"display:none;\">");
                else
                    sb.Append("<table width=\"90%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX1\" style=\"display:none;\">");

                sb.Append("<tr style=\"width: 80%;\" bgcolor=\"#CFE6FC\"> ");
                sb.Append("<td style=\"width: 20%;\"><div align=\"center\">指 标 名 称</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">单 位</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">设计值</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">#1机</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">#2机</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">全厂</td>");
                sb.Append("</tr>");

                for (int i = 1; i < zb.Length; i++)
                {
                    sb.Append("<tr>");

                    sb.AppendFormat("<td align='center'>{0}</td>", zb[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", un[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", lay[i]);

                    if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "累计" || dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                    {
                        if (dvExcel[i] != null)
                        {
                            if (dvExcel[i].TrimEnd(',').Contains(','))
                            {
                                arr = dvExcel[i].Split(',');

                                for (int j = 0; j < arr.Length - 1; j++)
                                {
                                    if (arr[j] != null)
                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                }
                            }
                        }
                    }
                    else
                    {
                        if (repName == "厂用电报表")
                        {
                            if (dvExcel[i] != null)
                            {
                                if (dvExcel[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcel[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }
                        }
                        else if (repName == "汽机报表" || repName == "锅炉报表")
                        {
                            if (dvExcel[i] != null)
                            {
                                if (dvExcel[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcel[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (j == 0)
                                            {
                                                if (tjxsA == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else if (j == 1)
                                            {
                                                if (tjxsB == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (dvExcel[i] != null)
                            {
                                if (dvExcel[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcel[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (i <= 10)
                                            { sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString()); }
                                            else
                                            {
                                                if (j == 0)
                                                {
                                                    if (tjxsA == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else if (j == 1)
                                                {
                                                    if (tjxsB == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }
                        }
                        sb.Append("</tr>");
                    }
                }

                sb.Append("</table>");
                #endregion
            }
            else
            { sb.Append("没有查询到结果..."); return sb.ToString(); }

            return sb.ToString();
        }

        /// <summary>
        /// 月报/年报(机组轮转)
        /// </summary>
        /// <param name="repName"></param>
        /// <param name="repType"></param>
        /// <param name="date"></param>
        /// <returns></returns>
        public string RetTableByMonth(string repName, string repType, DateTime date)
        {
            bool isTure = false;

            string[] arr;
            string pType = "";
            string qsrqB = "";
            string jsrqB = "";
            string qsrqT = "";
            string jsrqT = "";

            string tjxsA = "";
            string tjxsB = "";
            string tjxsTA = "";
            string tjxsTB = "";

            DateTime ndate = DateTime.Now.Date;

            if (date < Convert.ToDateTime(xzTime) || date > ndate)
            { sb.Append("请输入正确日期查询"); return sb.ToString(); }

            if (repType == "月报")
            {
                pType = "月点";

                if (date.Year == ndate.Year && date.Month == ndate.Month)
                {
                    qsrqB = date.ToString("yyyy-MM-dd H:mm:ss");
                    //jsrqB = DateTime.Now.AddHours(-1).ToString("yyyy-MM-dd H:00:00");
                    jsrqB = DateTime.Now.ToString("yyyy-MM-dd 0:00:00");

                    qsrqT = DateTime.Parse(qsrqB).AddYears(-1).ToString("yyyy-MM-dd H:mm:ss");
                    jsrqT = DateTime.Parse(qsrqB).AddYears(-1).AddMonths(+1).ToString("yyyy-MM-dd H:mm:ss");

                    isTure = true;
                }
                else
                {
                    qsrqB = date.ToString("yyyy-MM-dd H:mm:ss");
                    jsrqB = sh.LastDayOfMonth(DateTime.Parse(qsrqB)).AddDays(+1).ToString("yyyy-MM-dd H:mm:ss");

                    qsrqT = DateTime.Parse(qsrqB).AddYears(-1).ToString("yyyy-MM-dd H:mm:ss");
                    jsrqT = DateTime.Parse(jsrqB).AddYears(-1).ToString("yyyy-MM-dd H:mm:ss");
                }
            }
            else if (repType == "年报")
            {
                pType = "年点";

                if (date.Year == ndate.Year)
                {
                    qsrqB = date.ToString("yyyy-MM-dd H:mm:ss");
                    //jsrqB = DateTime.Now.AddHours(-1).ToString("yyyy-MM-dd H:00:00");
                    jsrqB = DateTime.Now.ToString("yyyy-MM-dd 0:00:00");

                    qsrqT = DateTime.Parse(qsrqB).AddYears(-1).ToString("yyyy-MM-dd H:mm:ss");
                    jsrqT = qsrqB;

                    isTure = true;
                }
                else
                {
                    qsrqB = date.ToString("yyyy-MM-dd H:mm:ss");
                    jsrqB = DateTime.Parse(qsrqB).AddYears(+1).ToString("yyyy-MM-dd H:mm:ss");

                    qsrqT = DateTime.Parse(qsrqB).AddYears(-1).ToString("yyyy-MM-dd H:mm:ss");
                    jsrqT = qsrqB;
                }
            }

            tjxsA = um.tjxs(qsrqB, jsrqB, 1);
            tjxsB = um.tjxs(qsrqB, jsrqB, 2);
            tjxsTA = um.tjxs(qsrqT, jsrqT, 1);
            tjxsTB = um.tjxs(qsrqT, jsrqT, 2);

            DataTable dtXZ = dr.RetTableXZ("1", repName);

            //list = dr.RetArrsRepMonth(repName, repType, pType, qsrqB, jsrqB, qsrqT, jsrqT, isTure);

            list = drp.RetArrsRepMonth(repName, repType, pType, qsrqB, jsrqB, qsrqT, jsrqT, isTure);

            string[] zb = (string[])list[0];
            string[] un = (string[])list[1];
            string[] lay = (string[])list[2];
            string[] dv = (string[])list[3];
            string[] dvT = (string[])list[4];
            string[] dvExcel = (string[])list[5];
            string[] dvExcelT = (string[])list[6];

            if (list.Count > 0)
            {
                sb.Append("<table width=\"98%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX1\">");
                sb.Append("<tr bgcolor=\"#CFE6FC\"> <td rowspan=\"2\" align=\"center\"> 指 标 名 称  </td>");
                sb.Append("<td rowspan=\"2\" align=\"center\">单 位</td>");
                sb.Append("<td rowspan=\"2\" align=\"center\">设 计 值</td>");
                sb.Append("<td colspan=\"3\" align=\"center\">本 期</td>");
                sb.Append("<td colspan=\"3\" align=\"center\">同 期</td></tr>");
                sb.Append("<tr bgcolor=\"#CFE6FC\"><td align=\"center\">#1机</td>");
                sb.Append("<td align=\"center\">#2机</td>");
                sb.Append("<td align=\"center\">全厂</td>");
                sb.Append("<td align=\"center\">#1机</td>");
                sb.Append("<td align=\"center\">#2机</td>");
                sb.Append("<td align=\"center\">全厂</td></tr>");

                for (int i = 1; i < zb.Length; i++)
                {
                    sb.Append("<tr>");

                    sb.AppendFormat("<td align='center'>{0}</td>", zb[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", un[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", lay[i]);

                    if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "累计" || dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                    {
                        if (dv[i] != null)
                        {
                            if (dv[i].TrimEnd(',').Contains(','))
                            {
                                arr = dv[i].Split(',');

                                for (int j = 0; j < arr.Length - 1; j++)
                                {
                                    if (arr[j] != null)
                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                }
                            }
                        }

                        if (dvT[i] != null)
                        {
                            if (dvT[i].TrimEnd(',').Contains(','))
                            {
                                arr = dvT[i].Split(',');

                                for (int j = 0; j < arr.Length - 1; j++)
                                {
                                    if (Convert.ToDateTime(qsrqT) > Convert.ToDateTime(xzTime))
                                    {
                                        if (arr[j] != null)
                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                }
                            }
                        }
                    }
                    else
                    {
                        if (repName == "厂用电报表")
                        {
                            if (dv[i] != null)
                            {
                                if (dv[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dv[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {

                                        if (arr[j] != null)
                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }

                            if (dvT[i] != null)
                            {
                                if (dvT[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvT[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (Convert.ToDateTime(qsrqT) > Convert.ToDateTime(xzTime))
                                        {
                                            if (arr[j] != null)
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                    }
                                }
                            }
                        }
                        else if (repName == "汽机报表" || repName == "锅炉报表")
                        {
                            if (dv[i] != null)
                            {
                                if (dv[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dv[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (j == 0)
                                            {
                                                if (tjxsA == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else if (j == 1)
                                            {
                                                if (tjxsB == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }

                            if (dvT[i] != null)
                            {
                                if (dvT[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvT[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (Convert.ToDateTime(qsrqT) > Convert.ToDateTime(xzTime))
                                        {
                                            if (arr[j] != null)
                                            {
                                                if (j == 0)
                                                {
                                                    if (tjxsTA == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else if (j == 1)
                                                {
                                                    if (tjxsTB == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (dv[i] != null)
                            {
                                if (dv[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dv[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (i <= 10)
                                            { sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString()); }
                                            else
                                            {
                                                if (j == 0)
                                                {
                                                    if (tjxsA == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else if (j == 1)
                                                {
                                                    if (tjxsB == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }

                            if (dvT[i] != null)
                            {
                                if (dvT[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvT[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (Convert.ToDateTime(qsrqT) > Convert.ToDateTime(xzTime))
                                        {
                                            if (arr[j] != null)
                                            {
                                                if (i <= 10)
                                                { sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString()); }
                                                else
                                                {
                                                    if (j == 0)
                                                    {
                                                        if (tjxsTA == "0")
                                                            sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                        else
                                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                    }
                                                    else if (j == 1)
                                                    {
                                                        if (tjxsTB == "0")
                                                            sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                        else
                                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                    }
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                    }
                                }
                            }
                        }
                        sb.Append("</tr>");
                    }
                }

                sb.Append("</table>");

                #region 导出 Excel 表

                sb.Append("<table width=\"98%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX\" style=\"display:none;\" >");
                sb.Append("<tr bgcolor=\"#CFE6FC\"> <td rowspan=\"2\" align=\"center\"> 指 标 名 称  </td>");
                sb.Append("<td rowspan=\"2\" align=\"center\">单 位</td>");
                sb.Append("<td rowspan=\"2\" align=\"center\">设 计 值</td>");
                sb.Append("<td colspan=\"3\" align=\"center\">本 期</td>");
                sb.Append("<td colspan=\"3\" align=\"center\">同 期</td></tr>");
                sb.Append("<tr bgcolor=\"#CFE6FC\"><td align=\"center\">#1机</td>");
                sb.Append("<td align=\"center\">#2机</td>");
                sb.Append("<td align=\"center\">全厂</td>");
                sb.Append("<td align=\"center\">#1机</td>");
                sb.Append("<td align=\"center\">#2机</td>");
                sb.Append("<td align=\"center\">全厂</td></tr>");

                for (int i = 1; i < zb.Length; i++)
                {
                    sb.Append("<tr>");

                    sb.AppendFormat("<td align='center'>{0}</td>", zb[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", un[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", lay[i]);

                    if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "累计" || dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                    {
                        if (dvExcel[i] != null)
                        {
                            if (dvExcel[i].TrimEnd(',').Contains(','))
                            {
                                arr = dvExcel[i].Split(',');

                                for (int j = 0; j < arr.Length - 1; j++)
                                {
                                    if (arr[j] != null)
                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                }
                            }
                        }

                        if (dvExcelT[i] != null)
                        {
                            if (dvExcelT[i].TrimEnd(',').Contains(','))
                            {
                                arr = dvExcelT[i].Split(',');

                                for (int j = 0; j < arr.Length - 1; j++)
                                {
                                    if (Convert.ToDateTime(qsrqT) > Convert.ToDateTime(xzTime))
                                    {
                                        if (arr[j] != null)
                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                }
                            }
                        }
                    }
                    else
                    {
                        if (repName == "厂用电报表")
                        {
                            if (dvExcel[i] != null)
                            {
                                if (dvExcel[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcel[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {

                                        if (arr[j] != null)
                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }

                            if (dvExcelT[i] != null)
                            {
                                if (dvExcelT[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcelT[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (Convert.ToDateTime(qsrqT) > Convert.ToDateTime(xzTime))
                                        {
                                            if (arr[j] != null)
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                    }
                                }
                            }
                        }
                        else if (repName == "汽机报表" || repName == "锅炉报表")
                        {
                            if (dvExcel[i] != null)
                            {
                                if (dvExcel[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcel[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (j == 0)
                                            {
                                                if (tjxsA == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else if (j == 1)
                                            {
                                                if (tjxsB == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }

                            if (dvExcelT[i] != null)
                            {
                                if (dvExcelT[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcelT[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (Convert.ToDateTime(qsrqT) > Convert.ToDateTime(xzTime))
                                        {
                                            if (arr[j] != null)
                                            {
                                                if (j == 0)
                                                {
                                                    if (tjxsTA == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else if (j == 1)
                                                {
                                                    if (tjxsTB == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (dvExcel[i] != null)
                            {
                                if (dvExcel[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcel[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (i <= 10)
                                            { sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString()); }
                                            else
                                            {
                                                if (j == 0)
                                                {
                                                    if (tjxsA == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else if (j == 1)
                                                {
                                                    if (tjxsB == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }

                            if (dvExcelT[i] != null)
                            {
                                if (dvExcelT[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcelT[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (Convert.ToDateTime(qsrqT) > Convert.ToDateTime(xzTime))
                                        {
                                            if (arr[j] != null)
                                            {
                                                if (i <= 10)
                                                { sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString()); }
                                                else
                                                {
                                                    if (j == 0)
                                                    {
                                                        if (tjxsTA == "0")
                                                            sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                        else
                                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                    }
                                                    else if (j == 1)
                                                    {
                                                        if (tjxsTB == "0")
                                                            sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                        else
                                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                    }
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                    }
                                }
                            }
                        }
                        sb.Append("</tr>");
                    }
                }

                sb.Append("</table>");

                #endregion
            }
            else
            { sb.Append("没有查询到结果..."); return sb.ToString(); }

            return sb.ToString();
        }

        /// <summary>
        /// 季报(机组轮转)
        /// </summary>
        /// <param name="repName"></param>
        /// <param name="repType"></param>
        /// <param name="date"></param>
        /// <returns></returns>
        public string RetTableByMonth(string repName, string repType, DateTime date, int jd)
        {
            bool isTure = false;

            string[] arr;
            string pType = "";
            string errMsg = "";
            string qsrqB = "";
            string jsrqB = "";
            string qsrqT = "";
            string jsrqT = "";

            string tjxsA = "";
            string tjxsB = "";
            string tjxsTA = "";
            string tjxsTB = "";

            DateTime ndate = DateTime.Now.Date;

            this.init();

            if (repType == "季报")
            {
                pType = "季点";
            }
            string res = this.IsQuarTerly(date, jd, out isTure, out errMsg);

            if (errMsg == "")
            {
                if (res.Contains(';'))
                {
                    string[] str = res.Split(';');

                    qsrqB = str[0];
                    jsrqB = str[1];
                    qsrqT = str[2];
                    jsrqT = str[3];
                }
            }
            else
            { sb.Append(errMsg); return sb.ToString(); }

            if (Convert.ToDateTime(qsrqB) < Convert.ToDateTime(xzTime))
            { sb.Append("请选择正确时间进行查询..."); return sb.ToString(); }

            tjxsA = um.tjxs(qsrqB, jsrqB, 1);
            tjxsB = um.tjxs(qsrqB, jsrqB, 2);
            tjxsTA = um.tjxs(qsrqT, jsrqT, 1);
            tjxsTB = um.tjxs(qsrqT, jsrqT, 2);

            DataTable dtXZ = dr.RetTableXZ("1", repName);

            list = drp.RetArrsRepMonth(repName, repType, pType, qsrqB, jsrqB, qsrqT, jsrqT, isTure);

            string[] zb = (string[])list[0];
            string[] un = (string[])list[1];
            string[] lay = (string[])list[2];
            string[] dv = (string[])list[3];
            string[] dvT = (string[])list[4];
            string[] dvExcel = (string[])list[5];
            string[] dvExcelT = (string[])list[6];

            if (list.Count > 0)
            {
                if (toExcel == "yes")
                    sb.Append("<table width=\"98%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX\">");
                else
                    sb.Append("<table width=\"98%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX1\">");

                sb.Append("<tr bgcolor=\"#CFE6FC\"> <td rowspan=\"2\" align=\"center\"> 指 标 名 称  </td>");
                sb.Append("<td rowspan=\"2\" align=\"center\">单 位</td>");
                sb.Append("<td rowspan=\"2\" align=\"center\">设 计 值</td>");
                sb.Append("<td colspan=\"3\" align=\"center\">本 期</td>");
                sb.Append("<td colspan=\"3\" align=\"center\">同 期</td></tr>");
                sb.Append("<tr bgcolor=\"#CFE6FC\"><td align=\"center\">#1机</td>");
                sb.Append("<td align=\"center\">#2机</td>");
                sb.Append("<td align=\"center\">全厂</td>");
                sb.Append("<td align=\"center\">#1机</td>");
                sb.Append("<td align=\"center\">#2机</td>");
                sb.Append("<td align=\"center\">全厂</td></tr>");

                for (int i = 1; i < zb.Length; i++)
                {
                    sb.Append("<tr>");

                    sb.AppendFormat("<td align='center'>{0}</td>", zb[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", un[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", lay[i]);

                    if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "累计" || dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                    {
                        if (dv[i] != null)
                        {
                            if (dv[i].TrimEnd(',').Contains(','))
                            {
                                arr = dv[i].Split(',');

                                for (int j = 0; j < arr.Length - 1; j++)
                                {
                                    if (arr[j] != null)
                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                }
                            }
                        }

                        if (dvT[i] != null)
                        {
                            if (dvT[i].TrimEnd(',').Contains(','))
                            {
                                arr = dvT[i].Split(',');

                                for (int j = 0; j < arr.Length - 1; j++)
                                {
                                    if (Convert.ToDateTime(qsrqT) > Convert.ToDateTime(xzTime))
                                    {
                                        if (arr[j] != null)
                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                }
                            }
                        }
                    }
                    else
                    {
                        if (repName == "厂用电报表")
                        {
                            if (dv[i] != null)
                            {
                                if (dv[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dv[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {

                                        if (arr[j] != null)
                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }

                            if (dvT[i] != null)
                            {
                                if (dvT[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvT[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (Convert.ToDateTime(qsrqT) > Convert.ToDateTime(xzTime))
                                        {
                                            if (arr[j] != null)
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                    }
                                }
                            }
                        }
                        else if (repName == "汽机报表" || repName == "锅炉报表")
                        {
                            if (dv[i] != null)
                            {
                                if (dv[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dv[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (j == 0)
                                            {
                                                if (tjxsA == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else if (j == 1)
                                            {
                                                if (tjxsB == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }

                            if (dvT[i] != null)
                            {
                                if (dvT[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvT[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (Convert.ToDateTime(qsrqT) > Convert.ToDateTime(xzTime))
                                        {
                                            if (arr[j] != null)
                                            {
                                                if (j == 0)
                                                {
                                                    if (tjxsTA == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else if (j == 1)
                                                {
                                                    if (tjxsTB == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (dv[i] != null)
                            {
                                if (dv[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dv[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (i <= 10)
                                            { sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString()); }
                                            else
                                            {
                                                if (j == 0)
                                                {
                                                    if (tjxsA == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else if (j == 1)
                                                {
                                                    if (tjxsB == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }

                            if (dvT[i] != null)
                            {
                                if (dvT[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvT[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (Convert.ToDateTime(qsrqT) > Convert.ToDateTime(xzTime))
                                        {
                                            if (arr[j] != null)
                                            {
                                                if (i <= 10)
                                                { sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString()); }
                                                else
                                                {
                                                    if (j == 0)
                                                    {
                                                        if (tjxsTA == "0")
                                                            sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                        else
                                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                    }
                                                    else if (j == 1)
                                                    {
                                                        if (tjxsTB == "0")
                                                            sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                        else
                                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                    }
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                    }
                                }
                            }
                        }
                        sb.Append("</tr>");
                    }
                }

                sb.Append("</table>");

                #region 导出 Excel 表

                if (toExcel == "no")
                    sb.Append("<table width=\"98%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX\" style=\"display:none;\" >");
                else
                    sb.Append("<table width=\"98%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX1\" style=\"display:none;\" >");


                sb.Append("<tr bgcolor=\"#CFE6FC\"> <td rowspan=\"2\" align=\"center\"> 指 标 名 称  </td>");
                sb.Append("<td rowspan=\"2\" align=\"center\">单 位</td>");
                sb.Append("<td rowspan=\"2\" align=\"center\">设 计 值</td>");
                sb.Append("<td colspan=\"3\" align=\"center\">本 期</td>");
                sb.Append("<td colspan=\"3\" align=\"center\">同 期</td></tr>");
                sb.Append("<tr bgcolor=\"#CFE6FC\"><td align=\"center\">#1机</td>");
                sb.Append("<td align=\"center\">#2机</td>");
                sb.Append("<td align=\"center\">全厂</td>");
                sb.Append("<td align=\"center\">#1机</td>");
                sb.Append("<td align=\"center\">#2机</td>");
                sb.Append("<td align=\"center\">全厂</td></tr>");

                for (int i = 1; i < zb.Length; i++)
                {
                    sb.Append("<tr>");

                    sb.AppendFormat("<td align='center'>{0}</td>", zb[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", un[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", lay[i]);

                    if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "累计" || dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                    {
                        if (dvExcel[i] != null)
                        {
                            if (dvExcel[i].TrimEnd(',').Contains(','))
                            {
                                arr = dvExcel[i].Split(',');

                                for (int j = 0; j < arr.Length - 1; j++)
                                {
                                    if (arr[j] != null)
                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                }
                            }
                        }

                        if (dvExcelT[i] != null)
                        {
                            if (dvExcelT[i].TrimEnd(',').Contains(','))
                            {
                                arr = dvExcelT[i].Split(',');

                                for (int j = 0; j < arr.Length - 1; j++)
                                {
                                    if (Convert.ToDateTime(qsrqT) > Convert.ToDateTime(xzTime))
                                    {
                                        if (arr[j] != null)
                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                }
                            }
                        }
                    }
                    else
                    {
                        if (repName == "厂用电报表")
                        {
                            if (dvExcel[i] != null)
                            {
                                if (dvExcel[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcel[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {

                                        if (arr[j] != null)
                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }

                            if (dvExcelT[i] != null)
                            {
                                if (dvExcelT[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcelT[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (Convert.ToDateTime(qsrqT) > Convert.ToDateTime(xzTime))
                                        {
                                            if (arr[j] != null)
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                    }
                                }
                            }
                        }
                        else if (repName == "汽机报表" || repName == "锅炉报表")
                        {
                            if (dvExcel[i] != null)
                            {
                                if (dvExcel[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcel[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (j == 0)
                                            {
                                                if (tjxsA == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else if (j == 1)
                                            {
                                                if (tjxsB == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }

                            if (dvExcelT[i] != null)
                            {
                                if (dvExcelT[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcelT[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (Convert.ToDateTime(qsrqT) > Convert.ToDateTime(xzTime))
                                        {
                                            if (arr[j] != null)
                                            {
                                                if (j == 0)
                                                {
                                                    if (tjxsTA == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else if (j == 1)
                                                {
                                                    if (tjxsTB == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (dvExcel[i] != null)
                            {
                                if (dvExcel[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcel[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (i <= 10)
                                            { sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString()); }
                                            else
                                            {
                                                if (j == 0)
                                                {
                                                    if (tjxsA == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else if (j == 1)
                                                {
                                                    if (tjxsB == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }

                            if (dvExcelT[i] != null)
                            {
                                if (dvExcelT[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcelT[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (Convert.ToDateTime(qsrqT) > Convert.ToDateTime(xzTime))
                                        {
                                            if (arr[j] != null)
                                            {
                                                if (i <= 10)
                                                { sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString()); }
                                                else
                                                {
                                                    if (j == 0)
                                                    {
                                                        if (tjxsTA == "0")
                                                            sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                        else
                                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                    }
                                                    else if (j == 1)
                                                    {
                                                        if (tjxsTB == "0")
                                                            sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                        else
                                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                    }
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                    }
                                }
                            }
                        }
                        sb.Append("</tr>");
                    }
                }

                sb.Append("</table>");

                #endregion
            }
            else
            { sb.Append("没有查询到结果..."); return sb.ToString(); }

            return sb.ToString();
        }

        /// <summary>
        /// 月明细
        /// (机组轮转)
        /// </summary>
        /// <param name="repName"></param>
        /// <param name="unit"></param>
        /// <param name="date"></param>
        /// <returns></returns>
        public string RetTableByMonthInfo(string repName, int unit, DateTime date)
        {
            int isDay;
            string fDay;
            string lDay;
            string[] arr;
            string[] qsrq;
            string[] jsrq;
            string[] tjxs;

            DateTime ndate = DateTime.Now.Date;

            this.init();

            if (date < DateTime.Parse(xzTime))
            {
                sb.Append("对不起,请选择其他日期查询...");
                return sb.ToString();
            }

            if (date.Year == ndate.Year && date.Month == ndate.Month && ndate.Day == 1)
            {
                sb.Append("对不起,请选择其他日期查询...");
                return sb.ToString();
            }

            if (date.Year == ndate.Year && date.Month == ndate.Month)
                isDay = 0;
            else
                isDay = 1;

            #region 日期&统计小时

            int days = DateTime.DaysInMonth(date.Year, date.Month);

            qsrq = new string[days + 1];
            jsrq = new string[days + 1];
            tjxs = new string[days + 1];

            #region 日期
            if (isDay == 0)
            {
                for (int i = 1; i < DateTime.Now.Day; i++)
                {
                    qsrq[i] = date.Year + "-" + date.Month + "-" + i + " 00:00:00";
                    jsrq[i] = DateTime.Parse(date.Year + "-" + date.Month + "-" + i + " 00:00:00").AddDays(1).ToString();
                }
                fDay = qsrq[1];
                lDay = DateTime.Now.AddHours(-1).ToString("yyyy-MM-dd H:00:00");
            }
            else
            {
                for (int i = 1; i < days + 1; i++)
                {
                    qsrq[i] = date.Year + "-" + date.Month + "-" + i + " 00:00:00";
                    jsrq[i] = DateTime.Parse(date.Year + "-" + date.Month + "-" + i + " 00:00:00").AddDays(1).ToString();
                }
                fDay = qsrq[1];
                lDay = jsrq[days];
            }

            #endregion

            for (int i = 1; i < qsrq.Length; i++)
            {
                if (qsrq[i] != null)
                    tjxs[i - 1] = um.tjxs(qsrq[i], jsrq[i], unit);
                else
                    tjxs[i - 1] = "0";
            }

            tjxs[days] = um.tjxs(fDay, lDay, unit); ;
            #endregion

            list = drp.RetArrsRepMonthInfo(repName, unit, date, isDay);

            DataTable dtXZ = dr.RetTableXZ(unit.ToString(), repName);

            string[] zb = (string[])list[0];
            string[] un = (string[])list[1];
            string[] lay = (string[])list[2];
            string[] dv = (string[])list[3];
            string[] dvExcel = (string[])list[4];

            if (list.Count > 0)
            {
                if (toExcel == "yes")
                    sb.Append("<table border=\"1\" width='2470px;' valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX\">");
                else
                    sb.Append("<table border=\"1\" width='2470px;' valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX1\">");

                sb.Append("<tr bgcolor=\"#CFE6FC\">");
                sb.Append("<td style=\"width: 220px;\"><div align=\"center\">指 标 名 称</td>");
                sb.Append("<td style=\"width: 65px;\"><div align=\"center\">单 位 </td>");
                sb.Append("<td style=\"width: 90px;\"><div align=\"center\">设 计 值</td>");

                for (int i = 1; i <= days; i++)
                {
                    sb.AppendFormat("<td style=\"width: 65px;\"><div align=\"center\">{0}</td>", i);
                }

                sb.Append("<td style=\"width: 80px;\"><div align=\"center\">月度累计</td></tr>");

                for (int i = 1; i < zb.Length; i++)
                {
                    sb.Append("<tr>");

                    sb.AppendFormat("<td align='center'>{0}</td>", zb[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", un[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", lay[i]);

                    if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "累计" || dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                    {
                        if (dv[i] != null)
                        {
                            if (dv[i].TrimEnd(',').Contains(','))
                            {
                                arr = dv[i].Split(',');

                                for (int j = 0; j < arr.Length - 1; j++)
                                {
                                    if (arr[j] != null)
                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                }
                            }
                        }
                    }
                    else
                    {
                        if (repName == "厂用电报表")
                        {
                            //if (zb[i] == "输煤单耗" || zb[i] == "输煤设备电率")
                            //{
                            //    if (dv[i] != null)
                            //    {
                            //        if (dv[i].TrimEnd(',').Contains(','))
                            //        {
                            //            arr = dv[i].Split(',');

                            //            for (int j = 0; j < arr.Length - 1; j++)
                            //            {
                            //                if (j == arr.Length - 1)
                            //                {
                            //                    if (arr[j] != null)
                            //                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                            //                    else
                            //                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                            //                }
                            //                else
                            //                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                            //            }
                            //        }
                            //    }
                            //}
                            //else
                            //{
                            if (dv[i] != null)
                            {
                                if (dv[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dv[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }
                            // }
                        }
                        else if (repName == "汽机报表" || repName == "锅炉报表")
                        {
                            if (dv[i] != null)
                            {
                                if (dv[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dv[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (tjxs[j] == "0")
                                                sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (dv[i] != null)
                            {
                                if (dv[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dv[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (i <= 10)
                                            { sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString()); }
                                            else
                                            {
                                                if (tjxs[j] == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }
                        }
                        sb.Append("</tr>");
                    }
                }
                sb.Append("</table>");

                #region 导出Excel表
                if (toExcel == "no")
                    sb.Append("<table border=\"1\" width='2470px;' valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\"  style=\"display:none;\" id=\"CX\">");
                else
                    sb.Append("<table border=\"1\" width='2470px;' valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\"  style=\"display:none;\" id=\"CX1\">");

                sb.Append("<tr bgcolor=\"#CFE6FC\">");
                sb.Append("<td style=\"width: 220px;\"><div align=\"center\">指 标 名 称</td>");
                sb.Append("<td style=\"width: 65px;\"><div align=\"center\">单 位 </td>");
                sb.Append("<td style=\"width: 90px;\"><div align=\"center\">设 计 值</td>");

                for (int i = 1; i <= days; i++)
                {
                    sb.AppendFormat("<td style=\"width: 65px;\"><div align=\"center\">{0}</td>", i);
                }

                sb.Append("<td style=\"width: 80px;\"><div align=\"center\">月度累计</td></tr>");

                for (int i = 1; i < zb.Length; i++)
                {
                    sb.Append("<tr>");

                    sb.AppendFormat("<td align='center'>{0}</td>", zb[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", un[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", lay[i]);

                    if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "累计" || dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                    {
                        if (dvExcel[i] != null)
                        {
                            if (dvExcel[i].TrimEnd(',').Contains(','))
                            {
                                arr = dvExcel[i].Split(',');

                                for (int j = 0; j < arr.Length - 1; j++)
                                {
                                    if (arr[j] != null)
                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                }
                            }
                        }
                    }
                    else
                    {
                        if (repName == "厂用电报表")
                        {
                            if (dvExcel[i] != null)
                            {
                                if (dvExcel[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcel[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }
                        }
                        else if (repName == "汽机报表" || repName == "锅炉报表")
                        {
                            if (dvExcel[i] != null)
                            {
                                if (dvExcel[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcel[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (tjxs[j] == "0")
                                                sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (dvExcel[i] != null)
                            {
                                if (dvExcel[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcel[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (i <= 10)
                                            { sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString()); }
                                            else
                                            {
                                                if (tjxs[j] == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }
                        }
                        sb.Append("</tr>");
                    }
                }
                sb.Append("</table>");

                #endregion
            }
            else
            { sb.Append("没有查询到结果..."); return sb.ToString(); }



            return sb.ToString();
        }

        /// <summary>
        /// 年明细
        /// (机组轮转)
        /// </summary>
        /// <param name="repName"></param>
        /// <param name="unit"></param>
        /// <param name="date"></param>
        /// <returns></returns>
        public string RetTableByYearInfo(string repName, int unit, DateTime date)
        {
            int isDay;
            string sDate = "";
            string[] arr;
            string[] qsrq = new string[12];
            string[] jsrq = new string[12];
            string[] qsrqT = new string[12];
            string[] jsrqT = new string[12];
            string[] tjxs = new string[14];

            ArrayList list = new ArrayList();

            DateTime ndate = DateTime.Now.Date;

            this.init();

            if (date < DateTime.Parse(xzTime))
            {
                sb.Append("对不起,请选择其他日期查询...");
                return sb.ToString();
            }

            if (date.Year == ndate.Year && ndate.Month == 1)
            {
                sb.AppendFormat("<td colspan=\"19\"  align='center'>{0}</td>", "对不起,请选择其他日期查询...");
                return sb.ToString();
            }

            if (date.Year <= ndate.Year)
            {
                if (date.Year == ndate.Year)
                    isDay = 0;
                else
                    isDay = 1;

                #region 日期
                //本期时间
                if (isDay == 0)
                {
                    for (int i = 0; i < DateTime.Now.Month; i++)
                    {
                        qsrq[i] = date.AddMonths(+i).ToString("yyyy-MM-dd H:mm:ss");
                        jsrq[i] = date.AddMonths(+i).AddMonths(+1).ToString("yyyy-MM-dd H:mm:ss");

                        if (DateTime.Parse(qsrq[i]).Month == DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 0:00:00")).Month)
                            jsrq[i] = DateTime.Now.ToString("yyyy-MM-dd 0:00:00");//DateTime.Now.AddHours(-1).ToString("yyyy-MM-dd")

                        sDate = jsrq[i];
                    }
                }
                else
                {
                    for (int i = 0; i < 12; i++)
                    {
                        qsrq[i] = date.AddMonths(+i).ToString("yyyy-MM-dd H:mm:ss");
                        jsrq[i] = date.AddMonths(+i).AddMonths(+1).ToString("yyyy-MM-dd H:mm:ss");
                        sDate = jsrq[i];
                    }
                }

                DateTime dtT = DateTime.Parse(qsrq[0]).AddYears(-1);

                //同期时间
                for (int i = 0; i < 12; i++)
                {
                    qsrqT[i] = dtT.AddMonths(i).ToString("yyyy-MM-dd H:mm:ss");
                    jsrqT[i] = dtT.AddMonths(i).AddMonths(+1).ToString("yyyy-MM-dd H:mm:ss");
                }

                for (int i = 0; i < qsrq.Length; i++)
                {
                    if (qsrq[i] != null)
                        tjxs[i] = um.tjxs(qsrq[i], jsrq[i], unit);
                    else
                        tjxs[i] = "0";
                }

                tjxs[12] = um.tjxs(qsrq[0], sDate, unit);      //本期年统计时间
                tjxs[13] = um.tjxs(qsrqT[0], jsrqT[11], unit); //同期年统计时间

                #endregion

                list = drp.RetArrsRepYearInfo(repName, unit, date, isDay);

                DataTable dtXZ = dr.RetTableXZ("1", repName);

                string[] zb = (string[])list[0];
                string[] un = (string[])list[1];
                string[] lay = (string[])list[2];
                string[] dv = (string[])list[3];
                string[] dvT = (string[])list[4];
                string[] zyB = (string[])list[5];
                string[] zyT = (string[])list[6];
                string[] dvExcel = (string[])list[7];
                string[] dvExcelT = (string[])list[8];

                if (list.Count > 0)
                {
                    #region 显示数据Table

                    if (toExcel == "yes")
                        sb.Append("<table style=\"float: left;\" width=\"110%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX\">");
                    else
                        sb.Append("<table style=\"float: left;\" width=\"110%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX1\">");

                    sb.Append("<tr bgcolor=\"#CFE6FC\">");
                    sb.Append("<td style=\"width=\"10%\" ><div align=\"center\">指 标 名 称</td>");
                    sb.Append("<td style=\"width=\"4%\"><div align=\"center\">单 位 </td>");
                    sb.Append("<td style=\"width=\"4%\"><div align=\"center\">设 计 值</td>");

                    for (int i = 1; i <= 12; i++)
                    {
                        sb.AppendFormat("<td style=\"width:5%\"><div align=\"center\">{0}</td>", i);
                    }

                    sb.Append("<td width=\"5%\" align=\"center\">年度累计</td>");

                    sb.Append("<td width=\"5%\" align=\"center\">本年最优</td>");

                    sb.Append("<td width=\"5%\" align=\"center\">同期累计值</td>");

                    sb.Append("<td width=\"5%\" align=\"center\">同期最优值</td></tr>");

                    for (int i = 1; i < zb.Length; i++)
                    {
                        sb.Append("<tr>");

                        sb.AppendFormat("<td align='center'>{0}</td>", zb[i]);

                        sb.AppendFormat("<td align='center'>{0}</td>", un[i]);

                        sb.AppendFormat("<td align='center'>{0}</td>", lay[i]);

                        if (dv[i] != null)
                        {
                            if (dv[i].TrimEnd(',').Contains(','))
                            {
                                arr = dv[i].Split(',');

                                for (int j = 0; j < arr.Length - 1; j++)
                                {

                                    if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "累计" || dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                                    {
                                        if (arr[j] != null)
                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                    else
                                    {
                                        //本期数据
                                        if (repName == "厂用电报表")
                                        {
                                            if (arr[j] != null)
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                        else if (repName == "综合报表")
                                        {
                                            if (arr[j] != null)
                                            {
                                                if (i <= 10)
                                                { sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString()); }
                                                else
                                                {
                                                    if (tjxs[j] == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                        else
                                        {
                                            if (arr[j] != null)
                                            {
                                                if (tjxs[j] == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                    }
                                }
                            }
                        }

                        //本期最优值
                        if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "累计" || dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                        { sb.AppendFormat("<td align='center'>{0}</td>", zyB[i]); }
                        else
                        {
                            if (repName == "厂用电报表")
                            { sb.AppendFormat("<td align='center'>{0}</td>", zyB[i]); }
                            else if (repName == "综合报表")
                            {
                                if (i <= 10)
                                { sb.AppendFormat("<td align='center'>{0}</td>", zyB[i]); }
                                else
                                {
                                    if (tjxs[12] == "0")
                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", zyB[i]);
                                }
                            }
                            else
                            {
                                if (tjxs[12] == "0")
                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                else
                                    sb.AppendFormat("<td align='center'>{0}</td>", zyB[i]);
                            }
                        }
                        /////////////////////////////////////////////
                        if (dvT[i] != null)
                        {
                            if (dvT[i].TrimEnd(',').Contains(','))
                            {
                                arr = dvT[i].Split(',');

                                if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "累计" || dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                                {
                                    if (Convert.ToDateTime(jsrqT[11]) > Convert.ToDateTime(xzTime))
                                    {
                                        if (arr[arr.Length - 2] != null)
                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[arr.Length - 2].ToString());
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                }
                                else
                                {
                                    //同期累计
                                    if (repName == "厂用电报表")
                                    {
                                        if (Convert.ToDateTime(jsrqT[11]) > Convert.ToDateTime(xzTime))
                                        {
                                            if (arr[arr.Length - 2] != null)
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[arr.Length - 2].ToString());
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                    }
                                    else if (repName == "综合报表")
                                    {
                                        if (Convert.ToDateTime(jsrqT[11]) > Convert.ToDateTime(xzTime))
                                        {
                                            if (arr[arr.Length - 2] != null)
                                            {
                                                if (i <= 10)
                                                { sb.AppendFormat("<td align='center'>{0}</td>", arr[arr.Length - 2].ToString()); }
                                                else
                                                {
                                                    if (tjxs[13] == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[arr.Length - 2].ToString());
                                                }
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                    }
                                    else
                                    {
                                        if (Convert.ToDateTime(jsrqT[11]) > Convert.ToDateTime(xzTime))
                                        {
                                            if (arr[arr.Length - 2] != null)
                                            {
                                                if (tjxs[13] == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[arr.Length - 2].ToString());
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                    }
                                }
                            }
                        }

                        if (Convert.ToDateTime(jsrqT[11]) > Convert.ToDateTime(xzTime))
                        {
                            if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "累计" || dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                            { sb.AppendFormat("<td align='center'>{0}</td>", zyT[i]); }
                            else
                            {
                                //同期最优值
                                if (repName == "厂用电报表")
                                { sb.AppendFormat("<td align='center'>{0}</td>", zyT[i]); }
                                else if (repName == "综合报表")
                                {
                                    if (i <= 10)
                                    { sb.AppendFormat("<td align='center'>{0}</td>", zyT[i]); }
                                    else
                                    {
                                        if (tjxs[13] == "0")
                                            sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", zyT[i]);
                                    }
                                }
                                else
                                {
                                    if (tjxs[13] == "0")
                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", zyT[i]);
                                }
                            }
                        }
                        else
                            sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                    }
                    sb.Append("</table>");

                    #endregion

                    #region 导出ExcelTable
                    if (toExcel == "no")
                        sb.Append("<table style=\"float: left;\" width=\"110%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" style=\"display:none;\" id=\"CX\">");
                    else
                        sb.Append("<table style=\"float: left;\" width=\"110%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" style=\"display:none;\" id=\"CX1\">");

                    sb.Append("<tr bgcolor=\"#CFE6FC\">");
                    sb.Append("<td style=\"width=\"10%\" ><div align=\"center\">指 标 名 称</td>");
                    sb.Append("<td style=\"width=\"4%\"><div align=\"center\">单 位 </td>");
                    sb.Append("<td style=\"width=\"4%\"><div align=\"center\">设 计 值</td>");

                    for (int i = 1; i <= 12; i++)
                    {
                        sb.AppendFormat("<td style=\"width:5%\"><div align=\"center\">{0}</td>", i);
                    }

                    sb.Append("<td width=\"5%\" align=\"center\">年度累计</td>");

                    sb.Append("<td width=\"5%\" align=\"center\">本年最优</td>");

                    sb.Append("<td width=\"5%\" align=\"center\">同期累计值</td>");

                    sb.Append("<td width=\"5%\" align=\"center\">同期最优值</td></tr>");

                    for (int i = 1; i < zb.Length; i++)
                    {
                        sb.Append("<tr>");

                        sb.AppendFormat("<td align='center'>{0}</td>", zb[i]);

                        sb.AppendFormat("<td align='center'>{0}</td>", un[i]);

                        sb.AppendFormat("<td align='center'>{0}</td>", lay[i]);

                        if (dvExcel[i] != null)
                        {
                            if (dvExcel[i].TrimEnd(',').Contains(','))
                            {
                                arr = dvExcel[i].Split(',');

                                for (int j = 0; j < arr.Length - 1; j++)
                                {

                                    if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "累计" || dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                                    {
                                        if (arr[j] != null)
                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                    else
                                    {
                                        //本期数据
                                        if (repName == "厂用电报表")
                                        {
                                            if (arr[j] != null)
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                        else if (repName == "综合报表")
                                        {
                                            if (arr[j] != null)
                                            {
                                                if (i <= 10)
                                                { sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString()); }
                                                else
                                                {
                                                    if (tjxs[j] == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                        else
                                        {
                                            if (arr[j] != null)
                                            {
                                                if (tjxs[j] == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                    }
                                }
                            }
                        }

                        //本期最优值
                        if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "累计" || dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                        { sb.AppendFormat("<td align='center'>{0}</td>", zyB[i]); }
                        else
                        {
                            if (repName == "厂用电报表")
                            { sb.AppendFormat("<td align='center'>{0}</td>", zyB[i]); }
                            else if (repName == "综合报表")
                            {
                                if (i <= 10)
                                { sb.AppendFormat("<td align='center'>{0}</td>", zyB[i]); }
                                else
                                {
                                    if (tjxs[12] == "0")
                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", zyB[i]);
                                }
                            }
                            else
                            {
                                if (tjxs[12] == "0")
                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                else
                                    sb.AppendFormat("<td align='center'>{0}</td>", zyB[i]);
                            }
                        }
                        /////////////////////////////////////////////
                        if (dvExcelT[i] != null)
                        {
                            if (dvExcelT[i].TrimEnd(',').Contains(','))
                            {
                                arr = dvExcelT[i].Split(',');

                                if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "累计" || dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                                {
                                    if (Convert.ToDateTime(jsrqT[11]) > Convert.ToDateTime(xzTime))
                                    {
                                        if (arr[arr.Length - 2] != null)
                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[arr.Length - 2].ToString());
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                }
                                else
                                {
                                    //同期累计
                                    if (repName == "厂用电报表")
                                    {
                                        if (Convert.ToDateTime(jsrqT[11]) > Convert.ToDateTime(xzTime))
                                        {
                                            if (arr[arr.Length - 2] != null)
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[arr.Length - 2].ToString());
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                    }
                                    else if (repName == "综合报表")
                                    {
                                        if (Convert.ToDateTime(jsrqT[11]) > Convert.ToDateTime(xzTime))
                                        {
                                            if (arr[arr.Length - 2] != null)
                                            {
                                                if (i <= 10)
                                                { sb.AppendFormat("<td align='center'>{0}</td>", arr[arr.Length - 2].ToString()); }
                                                else
                                                {
                                                    if (tjxs[13] == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[arr.Length - 2].ToString());
                                                }
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                    }
                                    else
                                    {
                                        if (Convert.ToDateTime(jsrqT[11]) > Convert.ToDateTime(xzTime))
                                        {
                                            if (arr[arr.Length - 2] != null)
                                            {
                                                if (tjxs[13] == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[arr.Length - 2].ToString());
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                                    }
                                }
                            }
                        }

                        if (Convert.ToDateTime(jsrqT[11]) > Convert.ToDateTime(xzTime))
                        {
                            if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "累计" || dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                            { sb.AppendFormat("<td align='center'>{0}</td>", zyT[i]); }
                            else
                            {
                                //同期最优值
                                if (repName == "厂用电报表")
                                { sb.AppendFormat("<td align='center'>{0}</td>", zyT[i]); }
                                else if (repName == "综合报表")
                                {
                                    if (i <= 10)
                                    { sb.AppendFormat("<td align='center'>{0}</td>", zyT[i]); }
                                    else
                                    {
                                        if (tjxs[13] == "0")
                                            sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", zyT[i]);
                                    }
                                }
                                else
                                {
                                    if (tjxs[13] == "0")
                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", zyT[i]);
                                }
                            }
                        }
                        else
                            sb.AppendFormat("<td align='center'>{0}</td>", "0"); //
                    }
                    sb.Append("</table>");
                    #endregion
                }
            }
            else
            {
                sb.AppendFormat("<td colspan=\"19\"  align='center'>{0}</td>", "对不起,请选择正确日期然后进行查询...");
                return sb.ToString();
            }

            return sb.ToString();
        }

        /// <summary>
        /// 日期判断
        /// </summary>
        private string IsQuarTerly(DateTime date, int jd, out bool isDay, out string errMsg)
        {
            string qsrqB = "";
            string jsrqB = "";
            string qsrqT = "";
            string jsrqT = "";

            isDay = false;
            errMsg = "";

            DateTime ndate = DateTime.Now;

            if (date.Year < ndate.Year)
            {
                #region  历史年份
                if (jd == 1)
                {
                    qsrqB = date.Year + "-01-01 00:00:00";
                    jsrqB = date.Year + "-04-01 00:00:00";

                    qsrqT = DateTime.Parse(qsrqB).AddYears(-1).ToString("yyyy-MM-dd H:mm:ss");
                    jsrqT = DateTime.Parse(jsrqB).AddYears(-1).ToString("yyyy-MM-dd H:mm:ss");

                }
                else if (jd == 2)
                {
                    qsrqB = date.Year + "-04-01 00:00:00";
                    jsrqB = date.Year + "-07-01 00:00:00";

                    qsrqT = DateTime.Parse(qsrqB).AddYears(-1).ToString("yyyy-MM-dd H:mm:ss");
                    jsrqT = DateTime.Parse(jsrqB).AddYears(-1).ToString("yyyy-MM-dd H:mm:ss");

                }
                else if (jd == 3)
                {
                    qsrqB = date.Year + "-07-01 00:00:00";
                    jsrqB = date.Year + "-10-01 00:00:00";

                    qsrqT = DateTime.Parse(qsrqB).AddYears(-1).ToString("yyyy-MM-dd H:mm:ss");
                    jsrqT = DateTime.Parse(jsrqB).AddYears(-1).ToString("yyyy-MM-dd H:mm:ss");

                }
                else
                {
                    qsrqB = date.Year + "-10-01 00:00:00";
                    jsrqB = DateTime.Parse(date.Year + "-12-31 00:00:00").AddDays(1).ToString("yyyy-MM-dd H:mm:ss");

                    qsrqT = DateTime.Parse(qsrqB).AddYears(-1).ToString("yyyy-MM-dd H:mm:ss");
                    jsrqT = DateTime.Parse(jsrqB).AddYears(-1).ToString("yyyy-MM-dd H:mm:ss");

                }
                #endregion
            }
            else if (date.Year == ndate.Year)
            {
                if (jd == 1)
                {
                    qsrqB = date.Year + "-01-01 00:00:00";
                    jsrqB = date.Year + "-04-01 00:00:00";

                    qsrqT = DateTime.Parse(qsrqB).AddYears(-1).ToString("yyyy-MM-dd H:mm:ss");
                    jsrqT = DateTime.Parse(jsrqB).AddYears(-1).ToString("yyyy-MM-dd H:mm:ss");
                }
                else if (jd == 2)
                {
                    qsrqB = date.Year + "-04-01 00:00:00";
                    jsrqB = date.Year + "-07-01 00:00:00";

                    qsrqT = DateTime.Parse(qsrqB).AddYears(-1).ToString("yyyy-MM-dd H:mm:ss");
                    jsrqT = DateTime.Parse(jsrqB).AddYears(-1).ToString("yyyy-MM-dd H:mm:ss");
                }
                else if (jd == 3)
                {
                    qsrqB = date.Year + "-07-01 00:00:00";
                    jsrqB = date.Year + "-10-01 00:00:00";

                    qsrqT = DateTime.Parse(qsrqB).AddYears(-1).ToString("yyyy-MM-dd H:mm:ss");
                    jsrqT = DateTime.Parse(jsrqB).AddYears(-1).ToString("yyyy-MM-dd H:mm:ss");
                }
                else
                {
                    qsrqB = date.Year + "-10-01 00:00:00";
                    jsrqB = DateTime.Parse(date.Year + "-12-31 00:00:00").AddDays(1).ToString("yyyy-MM-dd H:mm:ss");

                    qsrqT = DateTime.Parse(qsrqB).AddYears(-1).ToString("yyyy-MM-dd H:mm:ss");
                    jsrqT = DateTime.Parse(jsrqB).AddYears(-1).ToString("yyyy-MM-dd H:mm:ss");
                }

                if (ndate >= DateTime.Parse(qsrqB) && ndate < DateTime.Parse(jsrqB))
                {
                    //jsrqB = ndate.AddHours(-1).ToString("yyyy-MM-dd H:00:00");
                    jsrqB = ndate.ToString("yyyy-MM-dd 0:00:00");
                    isDay = true;
                }
                else if (ndate < DateTime.Parse(qsrqB))
                {
                    errMsg = "请重新选择时间进行查询...";
                }
            }
            else { errMsg = "请重新选择时间进行查询..."; }

            return qsrqB + ";" + jsrqB + ";" + qsrqT + ";" + jsrqT;
        }


        #region 中电芜湖电厂内部发送数据

        /// <summary>
        /// 日报(机组轮转)
        /// </summary>
        /// <param name="repName"></param>
        /// <param name="date"></param>
        /// <returns></returns>
        public DataTable RetTableByDayToMySql(string repName, string repType, DateTime date)
        {
            string[] arr;
            string qsrq;
            string jsrq;
            string tjxsA;
            string tjxsB;

            bool isTure = false;

            DateTime dtNow = DateTime.Now;
            DataTable dt = new DataTable();

            if (date < dtNow && date >= Convert.ToDateTime(xzTime))
            {
                if (dtNow.Year == date.Year && dtNow.Month == date.Month && dtNow.Day == date.Day)
                {
                    qsrq = date.ToString("yyyy-MM-dd 00:00:00");
                    jsrq = dtNow.AddHours(-1).ToString("yyyy-MM-dd H:00:00");
                    isTure = true;
                }
                else
                {
                    qsrq = date.ToString("yyyy-MM-dd H:mm:ss");
                    jsrq = date.AddDays(+1).ToString("yyyy-MM-dd H:mm:ss");
                }
            }
            else
            { sb.Append("请输入正确的日期进行查询......"); return null; }

            if (repType == "日报")
            { repType = "日点"; }

            tjxsA = um.tjxs(qsrq, jsrq, 1);
            tjxsB = um.tjxs(qsrq, jsrq, 2);

            list = dr.RetArrsRepDay(repName, repType, qsrq, jsrq, isTure);

            DataTable dtXZ = dr.RetTableXZ("1", repName);

            string[] zb = (string[])list[0];
            string[] un = (string[])list[1];
            string[] lay = (string[])list[2];
            string[] dv = (string[])list[3];
            string[] dvExcel = (string[])list[4];

            if (list.Count > 0)
            {
                dt.Columns.Add("指标名称", typeof(string));
                dt.Columns.Add("单位", typeof(string));
                dt.Columns.Add("设计值", typeof(string));
                dt.Columns.Add("#1号机组", typeof(string));
                dt.Columns.Add("#2号机组", typeof(string));
                dt.Columns.Add("全厂", typeof(string));
                dt.Columns.Add("写入时间", typeof(string));

                for (int i = 1; i < zb.Length; i++)
                {
                    DataRow dw = dt.NewRow();

                    dw[0] = zb[i];
                    dw[1] = un[i];
                    dw[2] = lay[i];

                    if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                    {
                        if (dv[i] != null)
                        {
                            if (dv[i].TrimEnd(',').Contains(','))
                            {
                                arr = dv[i].Split(',');

                                for (int j = 0; j < arr.Length - 1; j++)
                                {
                                    if (arr[j] != null)
                                        dw[j + 3] = arr[j].ToString();
                                    else
                                        dw[j + 3] = "";
                                }
                            }
                        }
                    }
                    else
                    {
                        if (repName == "厂用电报表")
                        {
                            if (dv[i] != null)
                            {
                                if (dv[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dv[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (zb[i] == "输煤单耗" || zb[i] == "输煤设备电率")
                                        { dw[j + 3] = "0"; }
                                        else
                                        {
                                            if (arr[j] != null)
                                                dw[j + 3] = arr[j].ToString();
                                            else
                                                dw[j + 3] = "";
                                        }
                                    }
                                }
                            }
                        }
                        else if (repName == "汽机报表" || repName == "锅炉报表")
                        {
                            if (dv[i] != null)
                            {
                                if (dv[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dv[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (j == 0)
                                            {
                                                if (tjxsA == "0")
                                                    dw[j + 3] = "0";
                                                else
                                                    dw[j + 3] = arr[j].ToString();
                                            }
                                            else if (j == 1)
                                            {
                                                if (tjxsB == "0")
                                                    dw[j + 3] = "0";
                                                else
                                                    dw[j + 3] = arr[j].ToString();
                                            }
                                            else
                                                dw[j + 3] = arr[j].ToString();
                                        }
                                        else
                                            dw[j + 3] = "";
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (dv[i] != null)
                            {
                                if (dv[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dv[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (i <= 10)
                                            { dw[j + 3] = arr[j].ToString(); }
                                            else
                                            {
                                                if (j == 0)
                                                {
                                                    if (tjxsA == "0")
                                                        dw[j + 3] = "0";
                                                    else
                                                        dw[j + 3] = arr[j].ToString();
                                                }
                                                else if (j == 1)
                                                {
                                                    if (tjxsB == "0")
                                                        dw[j + 3] = "0";
                                                    else
                                                        dw[j + 3] = arr[j].ToString();
                                                }
                                                else
                                                    dw[j + 3] = arr[j].ToString();
                                            }
                                        }
                                        else
                                            dw[j + 3] = "";
                                    }
                                }
                            }
                        }
                    }

                    dw[6] = qsrq;

                    dt.Rows.Add(dw);
                }
            }

            return dt;
        }

        #endregion

        public string test()
        {

            return Environment.CurrentDirectory + ":" + System.Web.HttpContext.Current.Request.PhysicalApplicationPath;
        }


        /// <summary>
        /// 小时报表
        /// </summary>
        /// <param name="repName">报表名称</param>
        /// <param name="unit">机组名称</param>
        /// <param name="date">查询时间</param>
        /// <returns>查询到的报表</returns>
        public string RetTableByDayInfo(string repName, int unit, DateTime date)
        {
            int isDay;
            string fDay;
            string lDay;
            string[] arr;
            string[] qsrq;
            string[] jsrq;
            string[] tjxs;

            DateTime ndate = DateTime.Now.Date;

            this.init();


            if (date < DateTime.Parse(xzTime))
            {
                sb.Append("对不起,请选择其他日期查询...");
                return sb.ToString();
            }

            if (date.Year == ndate.Year && date.Month == ndate.Month && ndate.Day == 1)
            {
                sb.Append("对不起,请选择其他日期查询...");
                return sb.ToString();
            }

            if (date.Year == ndate.Year && date.Month == ndate.Month && date.Day == ndate.Day && date.Hour != 24)
                isDay = 0;
            else
                isDay = 1;

            list = drp.RetArrsRepDayInfo(repName, unit, date, isDay);

            DataTable dtXZ = dr.RetTableXZ(unit.ToString(), repName);

            string[] zb = (string[])list[0];//参数
            string[] un = (string[])list[1];//单位
            string[] lay = (string[])list[2];//设计值
            string[] dv = (string[])list[3];//数据
            string[] dvExcel = (string[])list[4];//原始数据

            StringBuilder sp = new StringBuilder();

            if (list.Count > 0)
            {
                #region 报表
                if (repName == "报表一")
                {
                    #region 报表一

                    #region 报表展示
                    if (toExcel == "yes")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX1'>");

                    // 固定表头
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='28'>" + repName + "</td></tr>");
                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    sp.Append("<td rowspan='4' align=\"center\" width='60px'>时间</td><td rowspan='3' align=\"center\">指标</td><td colspan=\"3\" align=\"center\">主蒸汽</td>");
                    sp.Append("<td colspan=\"3\" align=\"center\">低压补气</td><td colspan=\"3\" align=\"center\">凝汽器</td><td colspan=\"2\" align=\"center\">高压汽包</td>");
                    sp.Append("<td colspan=\"2\" align=\"center\">低压汽包</td><td colspan=\"3\" align=\"center\">轴封供气</td><td colspan=\"8\" align=\"center\">支撑轴承</td><td colspan=\"2\" align=\"center\">推力轴承</td>");
                    sp.Append("</tr>");

                    //指标
                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i > 16 && i < 24)
                        {
                            continue;
                        }
                        else if (i == 24)
                        {
                            sp.Append("<td colspan='2'>1#</td>");
                            sp.Append("<td colspan='2'>2#</td>");
                            sp.Append("<td colspan='2'>3#</td>");
                            sp.Append("<td colspan='2'>4#</td>");
                        }
                        else
                        {
                            sp.AppendFormat("<td rowspan='2' style='width: 65px'>{0}</td>", zb[i]);
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i > 16 && i <= 24)
                            sp.AppendFormat("<td>{0}</td>", zb[i]);
                    }
                    sp.Append("</tr>");

                    //指标单位
                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    sp.Append("<td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");


                    //加载数据
                    int hours = 0;
                    if (isDay == 0)
                        hours = date.Hour;
                    else
                        hours = 24;
                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");


                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i];
                            if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #region 导出Excel表
                    if (toExcel == "no")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' style='display:none;' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' style='display:none;' id='CX'>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='28'>" + repName + "</td></tr>");
                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    sp.Append("<td rowspan='4' align=\"center\" width='60px'>时间</td><td rowspan='3' align=\"center\">指标</td><td colspan=\"3\" align=\"center\">主蒸汽</td>");
                    sp.Append("<td colspan=\"3\" align=\"center\">低压补气</td><td colspan=\"3\" align=\"center\">凝汽器</td><td colspan=\"2\" align=\"center\">高压汽包</td>");
                    sp.Append("<td colspan=\"2\" align=\"center\">低压汽包</td><td colspan=\"3\" align=\"center\">轴封供气</td><td colspan=\"8\" align=\"center\">支撑轴承</td><td colspan=\"2\" align=\"center\">推力轴承</td>");
                    sp.Append("</tr>");

                    //指标
                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i > 16 && i < 24)
                        {
                            continue;
                        }
                        else if (i == 24)
                        {
                            sp.Append("<td colspan='2'>1#</td>");
                            sp.Append("<td colspan='2'>2#</td>");
                            sp.Append("<td colspan='2'>3#</td>");
                            sp.Append("<td colspan='2'>4#</td>");
                        }
                        else
                        {
                            sp.AppendFormat("<td rowspan='2' style='width: 65px'>{0}</td>", zb[i]);
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i > 16 && i <= 24)
                            sp.AppendFormat("<td>{0}</td>", zb[i]);
                    }
                    sp.Append("</tr>");

                    //指标单位
                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    sp.Append("<td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    //加载数据
                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");

                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");


                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");

                    #endregion

                    #endregion
                }
                else if (repName == "报表二")
                {
                    #region 报表二

                    #region  报表展示
                    if (toExcel == "yes")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX1'>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='25'>" + repName + "</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='3'>时间</td><td rowspan='2'>名称</td>");
                    for (int i = 1; i <= 10; i++)
                    {

                        if (i < 4)
                        {
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        }
                        else if (i == 4)
                        {
                            sp.Append("<td colspan='2'>汽缸膨胀</td>");

                            sp.Append("<td colspan='2'>汽缸温度(内杠)</td>");
                        }
                        else if (i == 8)
                        {
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        }
                        else if (i == 9)
                        {
                            sp.Append("<td colspan='3'>润滑油</td>");

                            sp.Append("<td colspan='6'> EH油</td>");

                            sp.Append("<td colspan='4'>轴震(高)</td>");

                            sp.Append("<td colspan='2'>调阀后压力</td>");
                        }
                    }


                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int k = 0; k < zb.Length; k++)
                    {
                        if (k > 3 && k != 8)
                            sp.AppendFormat("<td>{0}</td>", zb[k]);
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    int hours = 0;
                    if (isDay == 0)
                        hours = date.Hour;
                    else
                        hours = 24;

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #region 导出Excel
                    if (toExcel == "no")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX1'>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='25'>" + repName + "</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='3'>时间</td><td rowspan='2'>名称</td>");
                    for (int i = 1; i <= 10; i++)
                    {

                        if (i < 4)
                        {
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        }
                        else if (i == 4)
                        {
                            sp.Append("<td colspan='2'>汽缸膨胀</td>");

                            sp.Append("<td colspan='2'>汽缸温度(内杠)</td>");
                        }
                        else if (i == 8)
                        {
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        }
                        else if (i == 9)
                        {
                            sp.Append("<td colspan='3'>润滑油</td>");

                            sp.Append("<td colspan='6'> EH油</td>");

                            sp.Append("<td colspan='4'>轴震(高)</td>");

                            sp.Append("<td colspan='2'>调阀后压力</td>");
                        }
                    }


                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int k = 0; k < zb.Length; k++)
                    {
                        if (k > 3 && k != 8)
                            sp.AppendFormat("<td>{0}</td>", zb[k]);
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #endregion
                }
                else if (repName == "报表三")
                {
                    #region 报表三

                    #region  报表展示
                    if (toExcel == "yes")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX1'>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='23'>" + repName + "</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='4'>时间</td><td rowspan='3'>名称</td><td colspan='5'>循环水</td><td colspan='6'>#1循环水泵</td><td colspan='6'>#2循环水泵</td><td colspan='4'>闭冷水</td></tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i <= zb.Length; i++)
                    {
                        if (i < 2)
                        {
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        }
                        else if (i == 2)
                        {
                            sp.Append("<td colspan='2'>凝器入口温度</td>");

                            sp.Append("<td colspan='2'>凝器出口温度</td>");

                            sp.Append("<td colspan='2'>滤网</td>");
                        }
                        else if (i > 7 && i < 10)
                        {
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        }
                        else if (i == 10)
                        {
                            sp.Append("<td colspan='2'>电机轴承</td>");

                            sp.Append("<td colspan='2'> 滤网</td>");
                        }
                        else if (i > 13 && i < 16)
                        {
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        }
                        else if (i == 16)
                        {
                            sp.Append("<td colspan='2'> 电机轴承</td>");
                        }
                        else if (i == 18)
                        {
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        }
                        else if (i == 19)
                        {
                            sp.Append("<td colspan='2'> 供水</td>");
                        }
                        else if (i == 21)
                        {
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int k = 1; k < zb.Length; k++)
                    {
                        if (k > 1 && k < 8 || k >= 10 && k <= 13 || k > 15 && k != 18 && k != 21)
                        {
                            sp.AppendFormat("<td>{0}</td>", zb[k]);
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    int hours = 0;
                    if (isDay == 0)
                        hours = date.Hour;
                    else
                        hours = 24;

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #region 导出Excel
                    if (toExcel == "no")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX1'>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='23'>" + repName + "</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='4'>时间</td><td rowspan='3'>名称</td><td colspan='5'>循环水</td><td colspan='6'>#1循环水泵</td><td colspan='6'>#2循环水泵</td><td colspan='4'>闭冷水</td></tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i <= zb.Length; i++)
                    {
                        if (i < 2)
                        {
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        }
                        else if (i == 2)
                        {
                            sp.Append("<td colspan='2'>凝器入口温度</td>");

                            sp.Append("<td colspan='2'>凝器出口温度</td>");

                            sp.Append("<td colspan='2'>滤网</td>");
                        }
                        else if (i > 7 && i < 10)
                        {
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        }
                        else if (i == 10)
                        {
                            sp.Append("<td colspan='2'>电机轴承</td>");

                            sp.Append("<td colspan='2'> 滤网</td>");
                        }
                        else if (i > 13 && i < 16)
                        {
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        }
                        else if (i == 16)
                        {
                            sp.Append("<td colspan='2'> 电机轴承</td>");
                        }
                        else if (i == 18)
                        {
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        }
                        else if (i == 19)
                        {
                            sp.Append("<td colspan='2'> 供水</td>");
                        }
                        else if (i == 21)
                        {
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int k = 1; k < zb.Length; k++)
                    {
                        if (k > 1 && k < 8 || k >= 10 && k <= 13 || k > 15 && k != 18 && k != 21)
                        {
                            sp.AppendFormat("<td>{0}</td>", zb[k]);
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #endregion
                }
                else if (repName == "报表四")
                {
                    #region 报表四

                    #region  报表展示
                    if (toExcel == "yes")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX1'>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='30'>" + repName + "</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='5'>时间</td><td rowspan='4'>名称</td><td colspan='6'>#1闭冷水泵</td><td colspan='6'> #2闭冷水泵</td><td colspan='6'>#1凝结水泵</td><td colspan='6'>#2凝结水泵</td><td colspan='4'>凝结水</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i <= zb.Length; i++)
                    {
                        if (i < 3 || i > 12 && i < 16 || i > 18 && i < 22 || i > 24 && i < 27)
                        {
                            sp.AppendFormat("<td rowspan='3'>{0}</td>", zb[i]);
                        }
                        else if (i == 3)
                        {
                            sp.Append("<td colspan='4'>轴承温度</td>");
                        }
                        else if (i > 6 && i < 9)
                        {
                            sp.AppendFormat("<td rowspan='3'>{0}</td>", zb[i]);
                        }
                        else if (i == 9)
                        {
                            sp.Append("<td colspan='4'>轴承温度</td>");
                        }
                        else if (i == 16)
                        {
                            sp.Append("<td colspan='3'> 轴承温度</td>");
                        }
                        else if (i == 22)
                        {
                            sp.Append("<td colspan='3'> 轴承温度</td>");
                        }
                        else if (i == 27)
                        {
                            sp.Append("<td colspan='2'> 凝器补水</td>");
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='2'>电机</td><td colspan='2'>泵</td><td colspan='2'>电机</td><td colspan='2'> 泵</td><td colspan='2'>电机</td>");
                    for (int i = 18; i < zb.Length; i++)
                    {
                        if (i == 18 || i == 24 || i > 26)
                        {
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        }
                        else if (i == 19)
                        {
                            sp.Append("<td colspan='2'> 电机</td>");
                        }

                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int k = 1; k < zb.Length; k++)
                    {
                        if (k > 2 && k < 6 || k > 7 && k <= 12 || k > 15 && k < 18 || k > 21 && k < 24)
                        {
                            sp.AppendFormat("<td>{0}</td>", zb[k]);
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    int hours = 0;
                    if (isDay == 0)
                        hours = date.Hour;
                    else
                        hours = 24;

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #region 导出Excel
                    if (toExcel == "no")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX1'>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='30'>" + repName + "</td></tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='5'>时间</td><td rowspan='4'>名称</td><td colspan='6'>#1闭冷水泵</td><td colspan='6'> #2闭冷水泵</td><td colspan='6'>#1凝结水泵</td><td colspan='6'>#2凝结水泵</td><td colspan='4'>凝结水</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i <= zb.Length; i++)
                    {
                        if (i < 3 || i > 12 && i < 16 || i > 18 && i < 22 || i > 24 && i < 27)
                        {
                            sp.AppendFormat("<td rowspan='3'>{0}</td>", zb[i]);
                        }
                        else if (i == 3)
                        {
                            sp.Append("<td colspan='4'>轴承温度</td>");
                        }
                        else if (i > 6 && i < 9)
                        {
                            sp.AppendFormat("<td rowspan='3'>{0}</td>", zb[i]);
                        }
                        else if (i == 9)
                        {
                            sp.Append("<td colspan='4'>轴承温度</td>");
                        }
                        else if (i == 16)
                        {
                            sp.Append("<td colspan='3'> 轴承温度</td>");
                        }
                        else if (i == 22)
                        {
                            sp.Append("<td colspan='3'> 轴承温度</td>");
                        }
                        else if (i == 27)
                        {
                            sp.Append("<td colspan='2'> 凝器补水</td>");
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='2'>电机</td><td colspan='2'>泵</td><td colspan='2'>电机</td><td colspan='2'> 泵</td><td colspan='2'>电机</td>");
                    for (int i = 18; i < zb.Length; i++)
                    {
                        if (i == 18 || i == 24 || i > 26)
                        {
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        }
                        else if (i == 19)
                        {
                            sp.Append("<td colspan='2'> 电机</td>");
                        }

                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int k = 1; k < zb.Length; k++)
                    {
                        if (k > 2 && k < 6 || k > 7 && k <= 12 || k > 15 && k < 18 || k > 21 && k < 24)
                        {
                            sp.AppendFormat("<td>{0}</td>", zb[k]);
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #endregion
                }
                else if (repName == "报表五")
                {
                    #region 报表五

                    #region  报表展示
                    if (toExcel == "yes")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX1'>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='27'>" + repName + "</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='5'>时间</td><td rowspan='4'>名称</td><td colspan='2'>开式水</td><td colspan='6'>#1开式水泵</td><td colspan='6'>#2开式水泵</td><td colspan='3'>#1真空泵</td><td colspan='3'>#2真空泵</td><td colspan='2'>#1再循环泵</td><td colspan='2'>#2再循环泵</td>");
                    sp.AppendFormat("<td rowspan='4'>{0}</td></tr>", zb[25]);

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length - 1; i++)
                    {
                        if (i < 5 || i > 8 && i < 11 || i > 14)
                        {
                            sp.AppendFormat("<td rowspan='3'>{0}</td>", zb[i]);
                        }
                        else if (i == 5 || i == 11)
                        {
                            sp.Append("<td colspan='4'>轴承温度</td>");
                        }
                    }
                    sp.Append("</tr>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='2'>电机</td><td colspan='2'>泵</td><td colspan='2'>电机</td><td colspan='2'>泵</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < 15; i++)
                    {
                        if (i >= 5 && i <= 8 || i >= 11 && i <= 14)
                        {
                            sp.AppendFormat("<td>{0}</td>", zb[i]);
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    int hours = 0;
                    if (isDay == 0)
                        hours = date.Hour;
                    else
                        hours = 24;

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #region 导出Excel
                    if (toExcel == "no")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX1'>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='27'>" + repName + "</td></tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='5'>时间</td><td rowspan='4'>名称</td><td colspan='2'>开式水</td><td colspan='6'>#1开式水泵</td><td colspan='6'>#2开式水泵</td><td colspan='3'>#1真空泵</td><td colspan='3'>#2真空泵</td><td colspan='2'>#1再循环泵</td><td colspan='2'>#2再循环泵</td>");
                    sp.AppendFormat("<td rowspan='4'>{0}</td></tr>", zb[25]);

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length - 1; i++)
                    {
                        if (i < 5 || i > 8 && i < 11 || i > 14)
                        {
                            sp.AppendFormat("<td rowspan='3'>{0}</td>", zb[i]);
                        }
                        else if (i == 5 || i == 11)
                        {
                            sp.Append("<td colspan='4'>轴承温度</td>");
                        }
                    }
                    sp.Append("</tr>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='2'>电机</td><td colspan='2'>泵</td><td colspan='2'>电机</td><td colspan='2'>泵</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < 15; i++)
                    {
                        if (i >= 5 && i <= 8 || i >= 11 && i <= 14)
                        {
                            sp.AppendFormat("<td>{0}</td>", zb[i]);
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #endregion
                }
                else if (repName == "报表六")
                {
                    #region 报表六

                    #region  报表展示
                    if (toExcel == "yes")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX1'>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='28'>" + repName + "</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='5'>时间</td><td rowspan='4'>名称</td><td colspan='11'>#1给水泵</td><td colspan='11'>#2给水泵</td><td colspan='4'>高压供水</td></tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i < 4 || i > 11 && i < 15 || i > 22 && i < 25)
                        {
                            sp.AppendFormat("<td rowspan='3'>{0}</td>", zb[i]);
                        }
                        else if (i == 5 || i == 15)
                        {
                            sp.Append("<td colspan='2'>压力</td>");
                            sp.Append("<td colspan='2'>密封水温</td>");
                            sp.Append("<td colspan='4'>轴承温度</td>");
                        }
                        else if (i == 25)
                        {
                            sp.Append("<td colspan='2'>高省温度</td>");
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i >= 4 && i <= 7 || i >= 15 && i <= 18 || i >= 25 && i <= 26)
                        {
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        }
                        else if (i == 8 || i == 19)
                        {
                            sp.Append("<td colspan='2'>电机</td>");
                            sp.Append("<td colspan='2'>泵</td>");
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i > 7 && i < 12 || i > 18 && i < 23)
                        {
                            sp.AppendFormat("<td>{0}</td>", zb[i]);
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    int hours = 0;
                    if (isDay == 0)
                        hours = date.Hour;
                    else
                        hours = 24;

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #region 导出Excel
                    if (toExcel == "no")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX1'>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='28'>" + repName + "</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='5'>时间</td><td rowspan='4'>名称</td><td colspan='11'>#1给水泵</td><td colspan='11'>#2给水泵</td><td colspan='4'>高压供水</td></tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i < 4 || i > 11 && i < 15 || i > 22 && i < 25)
                        {
                            sp.AppendFormat("<td rowspan='3'>{0}</td>", zb[i]);
                        }
                        else if (i == 5 || i == 15)
                        {
                            sp.Append("<td colspan='2'>压力</td>");
                            sp.Append("<td colspan='2'>密封水温</td>");
                            sp.Append("<td colspan='4'>轴承温度</td>");
                        }
                        else if (i == 25)
                        {
                            sp.Append("<td colspan='2'>高省温度</td>");
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i >= 4 && i <= 7 || i >= 15 && i <= 18 || i >= 25 && i <= 26)
                        {
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        }
                        else if (i == 8 || i == 19)
                        {
                            sp.Append("<td colspan='2'>电机</td>");
                            sp.Append("<td colspan='2'>泵</td>");
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i > 7 && i < 12 || i > 18 && i < 23)
                        {
                            sp.AppendFormat("<td>{0}</td>", zb[i]);
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #endregion
                }
                else if (repName == "报表七")
                {
                    #region 报表七

                    #region  报表展示
                    if (toExcel == "yes")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX1'>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='21'>" + repName + "</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='4'>时间</td><td rowspan='3'>名称</td>");
                    sp.AppendFormat("<td rowspan='3'>{0}</td>", zb[1]);
                    sp.Append("<td colspan='3'>高压过热器</td><td colspan='2'>轴加</td><td colspan='3'>凝结水加热器</td><td colspan='4'>汽包壁温</td><td colspan='4'>烟气</td><td colspan='2'>连扩</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 2; i < zb.Length; i++)
                    {
                        if (i < 8 || i > 17)
                        {
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        }
                        else if (i == 8)
                        {
                            sp.Append("<td colspan='2'>温度</td>");
                            sp.Append("<td colspan='2'>高压</td>");
                            sp.Append("<td colspan='2'>低压</td>");
                            sp.Append("<td colspan='2'>入口</td>");
                            sp.Append("<td colspan='2'>出口</td>");
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i >= 8 && i <= 17)
                        {
                            sp.AppendFormat("<td>{0}</td>", zb[i]);
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    int hours = 0;
                    if (isDay == 0)
                        hours = date.Hour;
                    else
                        hours = 24;

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #region 导出Excel
                    if (toExcel == "no")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX1'>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='21'>" + repName + "</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='4'>时间</td><td rowspan='3'>名称</td>");
                    sp.AppendFormat("<td rowspan='3'>{0}</td>", zb[1]);
                    sp.Append("<td colspan='3'>高压过热器</td><td colspan='2'>轴加</td><td colspan='3'>凝结水加热器</td><td colspan='4'>汽包壁温</td><td colspan='4'>烟气</td><td colspan='2'>连扩</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 2; i < zb.Length; i++)
                    {
                        if (i < 8 || i > 17)
                        {
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        }
                        else if (i == 8)
                        {
                            sp.Append("<td colspan='2'>温度</td>");
                            sp.Append("<td colspan='2'>高压</td>");
                            sp.Append("<td colspan='2'>低压</td>");
                            sp.Append("<td colspan='2'>入口</td>");
                            sp.Append("<td colspan='2'>出口</td>");
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i >= 8 && i <= 17)
                        {
                            sp.AppendFormat("<td>{0}</td>", zb[i]);
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #endregion
                }
                else if (repName == "报表八")
                {
                    #region 报表八

                    #region  报表展示
                    if (toExcel == "yes")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX1'>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='21'>" + repName + "</td></tr>");

                    sp.AppendFormat("<tr bgcolor='#CFE6FC'><td rowspan='4'>时间</td><td rowspan='3'>名称</td><td colspan='3'>高压供汽</td><td colspan='3'>中压抽汽</td><td colspan='3'>低压抽汽</td><td colspan='7'>汽机发电机温度</td><td rowspan='3'>{0}</td><td colspan='2'>大气</td></tr>", zb[17]);

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i < 12 || i > 15 && i != 17)
                        {
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        }
                        else if (i == 12)
                        {
                            sp.Append("<td colspan='2'>励端</td>");
                            sp.Append("<td colspan='2'>气端</td>");
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i >= 12 && i <= 15)
                        {
                            sp.AppendFormat("<td>{0}</td>", zb[i]);
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    int hours = 0;
                    if (isDay == 0)
                        hours = date.Hour;
                    else
                        hours = 24;

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #region 导出Excel
                    if (toExcel == "no")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX1'>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='21'>" + repName + "</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='4'>时间</td><td rowspan='3'>名称</td>");
                    sp.AppendFormat("<td rowspan='3'>{0}</td>", zb[1]);
                    sp.Append("<td colspan='3'>高压过热器</td><td colspan='2'>轴加</td><td colspan='3'>凝结水加热器</td><td colspan='4'>汽包壁温</td><td colspan='4'>烟气</td><td colspan='2'>连扩</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 2; i < zb.Length; i++)
                    {
                        if (i < 8 || i > 17)
                        {
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        }
                        else if (i == 8)
                        {
                            sp.Append("<td colspan='2'>温度</td>");
                            sp.Append("<td colspan='2'>高压</td>");
                            sp.Append("<td colspan='2'>低压</td>");
                            sp.Append("<td colspan='2'>入口</td>");
                            sp.Append("<td colspan='2'>出口</td>");
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i >= 8 && i <= 17)
                        {
                            sp.AppendFormat("<td>{0}</td>", zb[i]);
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #endregion
                }
                else if (repName == "报表九")
                {
                    #region 报表九

                    #region  报表展示
                    if (toExcel == "yes")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX1'>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='19'>" + repName + "</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='3'>时间</td><td rowspan='2'>名称</td>");

                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i < 4 || i == 10 || i == 17)
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        else if (i == 4)
                        {
                            sp.Append("<td colspan='4'>压气机</td>");
                            sp.Append("<td colspan='2'>轴承燃烧室压温度</td>");
                        }
                        else if (i == 11)
                            sp.Append("<td colspan='6'>压气机</td>");
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i >= 4 && i <= 9 || i >= 11 && i <= 16)
                            sp.AppendFormat("<td>{0}</td>", zb[i]);
                    }
                    sp.Append("</tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    int hours = 0;
                    if (isDay == 0)
                        hours = date.Hour;
                    else
                        hours = 24;

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #region 导出Excel
                    if (toExcel == "no")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX1'>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='19'>" + repName + "</td></tr>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='3'>时间</td><td rowspan='2'>名称</td>");

                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i < 4 || i == 10 || i == 17)
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        else if (i == 4)
                        {
                            sp.Append("<td colspan='4'>压气机</td>");
                            sp.Append("<td colspan='2'>轴承燃烧室压温度</td>");
                        }
                        else if (i == 11)
                            sp.Append("<td colspan='6'>压气机</td>");
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i >= 4 && i <= 9 || i >= 11 && i <= 16)
                            sp.AppendFormat("<td>{0}</td>", zb[i]);
                    }
                    sp.Append("</tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #endregion
                }
                else if (repName == "报表十")
                {
                    #region 报表十

                    #region  报表展示
                    if (toExcel == "yes")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX1'>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='19'>" + repName + "</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='4'>时间</td><td rowspan='3'>名称</td><td colspan='8'>轴承温度</td><td colspan='4'>轴振动</td><td colspan='4'>最大瓦振（振速）</td></tr>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='4'>发电机</td><td colspan='4'>燃机</td><td colspan='2'>发电机</td><td colspan='2'>燃机</td><td colspan='2'>发电机</td><td colspan='2'>燃机</td></tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", zb[i]);
                    }
                    sp.Append("</tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    int hours = 0;
                    if (isDay == 0)
                        hours = date.Hour;
                    else
                        hours = 24;

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #region 导出Excel
                    if (toExcel == "no")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX1'>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='19'>" + repName + "</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='4'>时间</td><td rowspan='3'>名称</td><td colspan='8'>轴承温度</td><td colspan='4'>轴振动</td><td colspan='4'>最大瓦振（振速）</td></tr>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='4'>发电机</td><td colspan='4'>燃机</td><td colspan='2'>发电机</td><td colspan='2'>燃机</td><td colspan='2'>发电机</td><td colspan='2'>燃机</td></tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", zb[i]);
                    }
                    sp.Append("</tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #endregion
                }
                else if (repName == "报表十一")
                {
                    #region 报表十一

                    #region  报表展示
                    if (toExcel == "yes")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX1'>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='19'>" + repName + "</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='3'>时间</td><td rowspan='2'>名称</td><td colspan='3'>润滑油</td><td colspan='2'>控制油</td>");

                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i > 5 && i < 10)
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        else if (i == 10)
                        {
                            sp.Append("<td colspan='6'>燃机发电机温度</td>");
                            sp.Append("<td colspan='2'>功率</td>");
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i <= 5 || i >= 10)
                            sp.AppendFormat("<td>{0}</td>", zb[i]);
                    }
                    sp.Append("</tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    int hours = 0;
                    if (isDay == 0)
                        hours = date.Hour;
                    else
                        hours = 24;

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #region 导出Excel
                    if (toExcel == "no")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX1'>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='19'>" + repName + "</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='3'>时间</td><td rowspan='2'>名称</td><td colspan='3'>润滑油</td><td colspan='2'>控制油</td>");

                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i > 5 && i < 10)
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        else if (i == 10)
                        {
                            sp.Append("<td colspan='6'>燃机发电机温度</td>");
                            sp.Append("<td colspan='2'>功率</td>");
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i <= 5 || i >= 10)
                            sp.AppendFormat("<td>{0}</td>", zb[i]);
                    }
                    sp.Append("</tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");

                    #endregion

                    #endregion
                }
                else if (repName == "报表十二")
                {
                    #region 报表十二

                    #region  报表展示
                    if (toExcel == "yes")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX1'>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='19'>" + repName + "</td></tr>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='3'>时间</td><td rowspan='2'>名称</td>");

                    for (int i = 1; i < zb.Length - 1; i++)
                    {
                        if (i < zb.Length - 2)
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        else
                            sp.Append("<td colspan='2'>#01启动变</td>");
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    sp.AppendFormat("<td>{0}</td>", zb[zb.Length - 2]);
                    sp.AppendFormat("<td>{0}</td>", zb[zb.Length - 1]);
                    sp.Append("</tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    int hours = 0;
                    if (isDay == 0)
                        hours = date.Hour;
                    else
                        hours = 24;

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #region 导出Excel
                    if (toExcel == "no")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX1'>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='19'>" + repName + "</td></tr>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='3'>时间</td><td rowspan='2'>名称</td>");

                    for (int i = 1; i < zb.Length - 1; i++)
                    {
                        if (i < zb.Length - 2)
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        else
                            sp.Append("<td colspan='2'>#01启动变</td>");
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    sp.AppendFormat("<td>{0}</td>", zb[zb.Length - 2]);
                    sp.AppendFormat("<td>{0}</td>", zb[zb.Length - 1]);
                    sp.Append("</tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #endregion
                }
                else if (repName == "报表十三")
                {
                    #region 报表十三

                    #region  报表展示
                    if (toExcel == "yes")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX1'>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='18'>" + repName + "</td></tr>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='3'>时间</td><td rowspan='2'>名称</td>");

                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i < 10 || i > 11 && i < 14 || i == 16)
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        else if (i == 10)
                            sp.Append("<td colspan='2'>转子对地电压</td>");
                        else if (i == 14)
                            sp.Append("<td colspan='2'># 2 髙厂变</td>");
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    sp.AppendFormat("<td>{0}</td>", zb[10]);
                    sp.AppendFormat("<td>{0}</td>", zb[11]);
                    sp.AppendFormat("<td>{0}</td>", zb[14]);
                    sp.AppendFormat("<td>{0}</td>", zb[15]);
                    sp.Append("</tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    int hours = 0;
                    if (isDay == 0)
                        hours = date.Hour;
                    else
                        hours = 24;

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #region 导出Excel
                    if (toExcel == "no")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX1'>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='18'>" + repName + "</td></tr>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='3'>时间</td><td rowspan='2'>名称</td>");

                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i < 10 || i > 11 && i < 14 || i == 16)
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        else if (i == 10)
                            sp.Append("<td colspan='2'>转子对地电压</td>");
                        else if (i == 14)
                            sp.Append("<td colspan='2'># 2 髙厂变</td>");
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    sp.AppendFormat("<td>{0}</td>", zb[10]);
                    sp.AppendFormat("<td>{0}</td>", zb[11]);
                    sp.AppendFormat("<td>{0}</td>", zb[14]);
                    sp.AppendFormat("<td>{0}</td>", zb[15]);
                    sp.Append("</tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #endregion
                }
                else if (repName == "报表十四")
                {
                    #region 报表十四

                    #region  报表展示
                    if (toExcel == "yes")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX1'>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='12'>" + repName + "</td></tr>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='3'>时间</td><td rowspan='2'>名称</td><td colspan='3'>6KVⅠ段母线</td>");
                    sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[4]);
                    sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[5]);
                    sp.Append("<td colspan='2'>#1、2机组PC A</td>");
                    sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[8]);
                    sp.Append("<td colspan='2'>#1、2机组PC B</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i != 4 && i != 5 && i != 8)
                            sp.AppendFormat("<td>{0}</td>", zb[i]);
                    }
                    sp.Append("</tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    int hours = 0;
                    if (isDay == 0)
                        hours = date.Hour;
                    else
                        hours = 24;

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #region 导出Excel
                    if (toExcel == "no")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX1'>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='12'>" + repName + "</td></tr>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='3'>时间</td><td rowspan='2'>名称</td><td colspan='3'>6KVⅠ段母线</td>");
                    sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[4]);
                    sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[5]);
                    sp.Append("<td colspan='2'>#1、2机组PC A</td>");
                    sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[8]);
                    sp.Append("<td colspan='2'>#1、2机组PC B</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i != 4 && i != 5 && i != 8)
                            sp.AppendFormat("<td>{0}</td>", zb[i]);
                    }
                    sp.Append("</tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #endregion
                }
                else if (repName == "报表十五")
                {
                    #region 报表十五

                    #region  报表展示
                    if (toExcel == "yes")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX1'>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='16'>" + repName + "</td></tr>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='3'>时间</td><td rowspan='2'>名称</td>");

                    sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[1]);
                    sp.Append("<td colspan='3'>化水PCA</td>");
                    sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[5]);
                    sp.Append("<td colspan='3'>补给水PC</td>");
                    sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[9]);
                    sp.Append("<td colspan='3'>公用PC</td>");
                    sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[13]);
                    sp.AppendFormat("<td rowspan='2'>{0}</td></tr>", zb[14]);

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 2; i < zb.Length - 2; i++)
                    {
                        if (i != 5 && i != 9)
                            sp.AppendFormat("<td>{0}</td>", zb[i]);
                    }
                    sp.Append("</tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    int hours = 0;
                    if (isDay == 0)
                        hours = date.Hour;
                    else
                        hours = 24;

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #region 导出Excel
                    if (toExcel == "no")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX1'>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='16'>" + repName + "</td></tr>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='3'>时间</td><td rowspan='2'>名称</td>");

                    sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[1]);
                    sp.Append("<td colspan='3'>化水PCA</td>");
                    sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[5]);
                    sp.Append("<td colspan='3'>补给水PC</td>");
                    sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[9]);
                    sp.Append("<td colspan='3'>公用PC</td>");
                    sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[13]);
                    sp.AppendFormat("<td rowspan='2'>{0}</td></tr>", zb[14]);

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 2; i < zb.Length - 2; i++)
                    {
                        if (i != 5 && i != 9)
                            sp.AppendFormat("<td>{0}</td>", zb[i]);
                    }
                    sp.Append("</tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #endregion
                }
                else if (repName == "报表十六")
                {
                    #region 报表十六

                    #region  报表展示
                    if (toExcel == "yes")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX1'>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='26'>" + repName + "</td></tr>");
                    sp.AppendFormat("<tr bgcolor='#CFE6FC'><td rowspan='4'>时间</td><td rowspan='3'>名称</td><td colspan='5'>4H01</td><td colspan='5'>4H02</td><td>2630</td><td>2500</td><td>2600</td><td>2650</td><td colspan='2'>220KVⅠ母</td><td colspan='2'>220KV Ⅱ母</td><td colspan='2'>220KV Ⅲ母</td><td colspan='2'>220KV Ⅳ母</td><td rowspan='3'>{0}</td></tr>", zb[zb.Length - 1]);

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length - 1; i++)
                    {
                        if (i == 2 || i == 7)
                        {
                            sp.Append("<td colspan='2'>有功功率</td>");
                            sp.Append("<td colspan='2'>无功功率</td>");
                        }
                        else if (i == 1 || i == 6 || i > 10)
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 2; i < zb.Length; i++)
                    {
                        if (i != 6 && i < 11)
                            sp.AppendFormat("<td>{0}</td>", zb[i]);
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    int hours = 0;
                    if (isDay == 0)
                        hours = date.Hour;
                    else
                        hours = 24;

                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #region 导出Excel
                    if (toExcel == "no")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX1'>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='26'>" + repName + "</td></tr>");
                    sp.AppendFormat("<tr bgcolor='#CFE6FC'><td rowspan='4'>时间</td><td rowspan='3'>名称</td><td colspan='5'>4H01</td><td colspan='5'>4H02</td><td>2630</td><td>2500</td><td>2600</td><td>2650</td><td colspan='2'>220KVⅠ母</td><td colspan='2'>220KV Ⅱ母</td><td colspan='2'>220KV Ⅲ母</td><td colspan='2'>220KV Ⅳ母</td><td rowspan='3'>{0}</td></tr>", zb[zb.Length - 1]);

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length - 1; i++)
                    {
                        if (i == 2 || i == 7)
                        {
                            sp.Append("<td colspan='2'>有功功率</td>");
                            sp.Append("<td colspan='2'>无功功率</td>");
                        }
                        else if (i == 1 || i == 6 || i > 10)
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 2; i < zb.Length; i++)
                    {
                        if (i != 6 && i < 11)
                            sp.AppendFormat("<td>{0}</td>", zb[i]);
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");


                    for (int i = 0; i < hours; i++)
                    {
                        sp.Append("<tr>");
                        if (i != 23)
                            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                        else
                            sp.Append("<td colspan='2' align='center'>24:00</td>");

                        for (int k = 1; k < dv.Length; k++)
                        {
                            string[] str = dv[k].Split(',');
                            string value = dv[k].Split(',')[i]; if (value == "0")
                            {
                                value = "&nbsp;";
                            }
                            sp.AppendFormat("<td>{0}</td>", value);
                        }
                        sp.Append("</tr>");
                    }
                    sp.Append("</table>");
                    #endregion

                    #endregion
                }
                else if (repName == "报表十七")
                {
                    #region 报表十七
                    int[] nu = { 1650000, 1650000, 880000, 880000, 1650000, 1650000, 880000, 880000, 1650000, 1650000, 880000, 880000, 330000, 330000, 4400000, 4400000, 4400000, 4400000, 4400000, 4400000, 4400000, 4400000 };

                    #region  报表展示
                    if (toExcel == "yes")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX1'>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='23' height='30px'>" + repName + "</td></tr>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='3'></td><td colspan='2'>#1主变</td><td colspan='2'>#2主变</td><td colspan='2'>#3主变</td><td colspan='2'>#4主变</td><td colspan='2'>#5主变</td><td colspan='2'>#6主变</td><td colspan='2'>#01启动变</td><td colspan='4'>仪肖4H01</td><td colspan='4'>仪肖4H02</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i <= 14)
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        else if (i == 15)
                        {
                            sp.Append("<td colspan='2'>输入</td>");
                            sp.Append("<td colspan='2'>输出</td>");
                            sp.Append("<td colspan='2'>输入</td>");
                            sp.Append("<td colspan='2'>输出</td>");
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 15; i < zb.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", zb[i]);

                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    int count = 0;
                    if (isDay == 0)
                    {
                        count = date.Hour / 8;
                    }
                    else
                    {
                        count = 3;
                    }

                    if (count > 0)
                    {
                        for (int i = 0; i <= count; i++)
                        {
                            sp.Append("<tr>");
                            sp.Append("<td align='center'>" + (i * 8) + ":00</td>");
                            for (int k = 1; k < dv.Length; k++)
                            {
                                string[] str = dv[k].Split(',');
                                string value = dv[k].Split(',')[i]; if (value == "0")
                                {
                                    value = "&nbsp;";
                                }
                                sp.AppendFormat("<td>{0}</td>", value);
                            }
                            sp.Append("</tr>");
                        }

                        int index = 0;
                        for (int i = 0; i <= count - 1; i++)
                        {
                            sp.Append("<tr>");
                            sp.Append("<td align='center' width='100px'>" + (i * 8) + ":00——" + ((i + 1) * 8) + ":00</td>");
                            for (int k = 1; k < dv.Length; k++)
                            {
                                string[] str = dv[k].Split(',');
                                double startValue = Convert.ToDouble(dv[k].Split(',')[i]);
                                double endValue = Convert.ToDouble(dv[k].Split(',')[i + 1]);

                                string value = ((endValue - startValue) * nu[k - 1] / 1000).ToString();

                                if (value != "0" && value.IndexOf('.') != -1)
                                {
                                    value += "00";
                                    index = value.IndexOf('.');
                                    value = value.Substring(0, index + 3);
                                }
                                //if (value == "0")
                                //{
                                //    value = "&nbsp;";
                                //}
                                sp.AppendFormat("<td>{0}</td>", value);
                            }
                            sp.Append("</tr>");
                        }

                        sp.Append("<tr><td height='20px'>总     计</td>");
                        for (int i = 0; i <= count - 1; i++)
                        {
                            if (i == count - 1)
                            {
                                for (int k = 1; k < dv.Length; k++)
                                {
                                    string[] str = dv[k].Split(',');
                                    double startValue = Convert.ToDouble(dv[k].Split(',')[0]);
                                    double endValue = Convert.ToDouble(dv[k].Split(',')[i + 1]);
                                    string value = ((endValue - startValue) * nu[k - 1] / 1000).ToString();

                                    if (value != "0" && value.IndexOf('.') != -1)
                                    {
                                        value += "00";
                                        index = value.IndexOf('.');
                                        value = value.Substring(0, index + 3);
                                    }
                                    //if (value == "0")
                                    //{
                                    //    value = "&nbsp;";
                                    //}
                                    sp.AppendFormat("<td width='50px'>{0}</td>", value);
                                }
                            }
                        }
                        sp.Append("</tr>");

                    }

                    sp.Append("</table>");
                    #endregion

                    #region 导出Excel
                    if (toExcel == "no")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX1'>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='23' height='30px'>" + repName + "</td></tr>");
                    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='3'></td><td colspan='2'>#1主变</td><td colspan='2'>#2主变</td><td colspan='2'>#3主变</td><td colspan='2'>#4主变</td><td colspan='2'>#5主变</td><td colspan='2'>#6主变</td><td colspan='2'>#01启动变</td><td colspan='4'>仪肖4H01</td><td colspan='4'>仪肖4H02</td></tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 1; i < zb.Length; i++)
                    {
                        if (i <= 14)
                            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                        else if (i == 15)
                        {
                            sp.Append("<td colspan='2'>输入</td>");
                            sp.Append("<td colspan='2'>输出</td>");
                            sp.Append("<td colspan='2'>输入</td>");
                            sp.Append("<td colspan='2'>输出</td>");
                        }
                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 15; i < zb.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", zb[i]);

                    }
                    sp.Append("</tr>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    for (int i = 1; i < un.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", un[i]);
                    }
                    sp.Append("</tr>");

                    if (count > 0)
                    {
                        for (int i = 0; i <= count; i++)
                        {
                            sp.Append("<tr>");
                            sp.Append("<td align='center'>" + (i * 8) + ":00</td>");
                            for (int k = 1; k < dv.Length; k++)
                            {
                                string[] str = dv[k].Split(',');
                                string value = dv[k].Split(',')[i]; if (value == "0")
                                {
                                    value = "&nbsp;";
                                }
                                sp.AppendFormat("<td>{0}</td>", value);
                            }
                            sp.Append("</tr>");
                        }

                        int index = 0;
                        for (int i = 0; i <= count - 1; i++)
                        {
                            sp.Append("<tr>");
                            sp.Append("<td align='center' width='100px'>" + (i * 8) + ":00——" + ((i + 1) * 8) + ":00</td>");
                            for (int k = 1; k < dv.Length; k++)
                            {
                                string[] str = dv[k].Split(',');
                                double startValue = Convert.ToDouble(dv[k].Split(',')[i]);
                                double endValue = Convert.ToDouble(dv[k].Split(',')[i + 1]);

                                string value = ((endValue - startValue) * nu[k - 1] / 1000).ToString();

                                if (value != "0" && value.IndexOf('.') != -1)
                                {
                                    value += "00";
                                    index = value.IndexOf('.');
                                    value = value.Substring(0, index + 3);
                                }
                                //if (value == "0")
                                //{
                                //    value = "&nbsp;";
                                //}
                                sp.AppendFormat("<td>{0}</td>", value);
                            }
                            sp.Append("</tr>");
                        }

                        sp.Append("<tr><td height='20px'>总     计</td>");
                        for (int i = 0; i <= count - 1; i++)
                        {
                            if (i == count - 1)
                            {
                                for (int k = 1; k < dv.Length; k++)
                                {
                                    string[] str = dv[k].Split(',');
                                    double startValue = Convert.ToDouble(dv[k].Split(',')[0]);
                                    double endValue = Convert.ToDouble(dv[k].Split(',')[i + 1]);
                                    string value = ((endValue - startValue) * nu[k - 1] / 1000).ToString();

                                    if (value != "0" && value.IndexOf('.') != -1)
                                    {
                                        value += "00";
                                        index = value.IndexOf('.');
                                        value = value.Substring(0, index + 3);
                                    }
                                    //if (value == "0")
                                    //{
                                    //    value = "&nbsp;";
                                    //}
                                    sp.AppendFormat("<td width='50px'>{0}</td>", value);
                                }
                            }
                        }
                        sp.Append("</tr>");

                    }

                    sp.Append("</table>");
                    #endregion

                    #endregion
                }
                else if (repName == "报表十八")
                {
                    #region 报表十八

                    #region  报表展示
                    int[] nu = { 1650000, 1650000, 880000, 880000, 1650000, 1650000, 880000, 880000, 1650000, 1650000, 880000, 880000, 330000, 330000, 4400000, 4400000, 4400000, 4400000, 4400000, 4400000, 4400000, 4400000 };

                    if (toExcel == "yes")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX1'>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='16' height='30px'>" + repName + "</td></tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 0; i < zb.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", zb[i]);
                    }
                    sp.Append("</tr>");

                    //sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    //for (int i = 1; i < un.Length; i++)
                    //{
                    //    sp.AppendFormat("<td>{0}</td>", un[i]);
                    //}
                    //sp.Append("</tr>");

                    int count = 0;
                    if (isDay == 0)
                    {
                        count = date.Hour / 8;
                    }
                    else
                    {
                        count = 3;
                    }

                    if (count > 0)
                    {
                        for (int i = 0; i <= count; i++)
                        {
                            sp.Append("<tr>");
                            sp.Append("<td align='center'>" + (i * 8) + ":00</td>");
                            for (int k = 1; k < dv.Length; k++)
                            {
                                string[] str = dv[k].Split(',');
                                string value = dv[k].Split(',')[i]; if (value == "0")
                                {
                                    value = "&nbsp;";
                                }
                                sp.AppendFormat("<td>{0}</td>", value);
                            }
                            sp.Append("</tr>");
                        }

                        int index = 0;
                        for (int i = 0; i <= count - 1; i++)
                        {
                            sp.Append("<tr>");
                            sp.Append("<td align='center' width='100px'>" + (i * 8) + ":00——" + ((i + 1) * 8) + ":00</td>");
                            for (int k = 1; k < dv.Length; k++)
                            {
                                string[] str = dv[k].Split(',');
                                double startValue = Convert.ToDouble(dv[k].Split(',')[i]);
                                double endValue = Convert.ToDouble(dv[k].Split(',')[i + 1]);

                                string value = ((endValue - startValue) * nu[k - 1] / 1000).ToString();

                                if (value != "0" && value.IndexOf('.') != -1)
                                {
                                    value += "00";
                                    index = value.IndexOf('.');
                                    value = value.Substring(0, index + 3);
                                }
                                //if (value == "0")
                                //{
                                //    value = "&nbsp;";
                                //}
                                sp.AppendFormat("<td>{0}</td>", value);
                            }
                            sp.Append("</tr>");
                        }

                        sp.Append("<tr><td height='20px'>总     计</td>");
                        for (int i = 0; i <= count - 1; i++)
                        {
                            if (i == count - 1)
                            {
                                for (int k = 1; k < dv.Length; k++)
                                {
                                    string[] str = dv[k].Split(',');
                                    double startValue = Convert.ToDouble(dv[k].Split(',')[0]);
                                    double endValue = Convert.ToDouble(dv[k].Split(',')[i + 1]);
                                    string value = ((endValue - startValue) * nu[k - 1] / 1000).ToString();

                                    if (value != "0" && value.IndexOf('.') != -1)
                                    {
                                        value += "00";
                                        index = value.IndexOf('.');
                                        value = value.Substring(0, index + 3);
                                    }
                                    //if (value == "0")
                                    //    value = "&nbsp;";
                                    sp.AppendFormat("<td width='50px'>{0}</td>", value);
                                }
                            }
                        }
                        sp.Append("</tr>");

                    }

                    sp.Append("</table>");
                    #endregion

                    #region 导出Excel
                    if (toExcel == "no")
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX'>");
                    else
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX1'>");

                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='16' height='30px'>" + repName + "</td></tr>");


                    sp.Append("<tr bgcolor='#CFE6FC'>");
                    for (int i = 0; i < zb.Length; i++)
                    {
                        sp.AppendFormat("<td>{0}</td>", zb[i]);
                    }
                    sp.Append("</tr>");

                    //sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                    //for (int i = 1; i < un.Length; i++)
                    //{
                    //    sp.AppendFormat("<td>{0}</td>", un[i]);
                    //}
                    //sp.Append("</tr>");

                    if (count > 0)
                    {
                        for (int i = 0; i <= count; i++)
                        {
                            sp.Append("<tr>");
                            sp.Append("<td align='center'>" + (i * 8) + ":00</td>");
                            for (int k = 1; k < dv.Length; k++)
                            {
                                string[] str = dv[k].Split(',');
                                string value = dv[k].Split(',')[i];
                                sp.AppendFormat("<td>{0}</td>", value);
                            }
                            sp.Append("</tr>");
                        }

                        int index = 0;
                        for (int i = 0; i <= count - 1; i++)
                        {
                            sp.Append("<tr>");
                            sp.Append("<td align='center' width='100px'>" + (i * 8) + ":00——" + ((i + 1) * 8) + ":00</td>");
                            for (int k = 1; k < dv.Length; k++)
                            {
                                string[] str = dv[k].Split(',');
                                double startValue = Convert.ToDouble(dv[k].Split(',')[i]);
                                double endValue = Convert.ToDouble(dv[k].Split(',')[i + 1]);

                                string value = ((endValue - startValue) * nu[k - 1] / 1000).ToString();

                                if (value != "0" && value.IndexOf('.') != -1)
                                {
                                    value += "00";
                                    index = value.IndexOf('.');
                                    value = value.Substring(0, index + 3);
                                }

                                sp.AppendFormat("<td>{0}</td>", value);
                            }
                            sp.Append("</tr>");
                        }

                        sp.Append("<tr><td height='20px'>总     计</td>");
                        for (int i = 0; i <= count - 1; i++)
                        {
                            if (i == count - 1)
                            {
                                for (int k = 1; k < dv.Length; k++)
                                {
                                    string[] str = dv[k].Split(',');
                                    double startValue = Convert.ToDouble(dv[k].Split(',')[0]);
                                    double endValue = Convert.ToDouble(dv[k].Split(',')[i + 1]);
                                    string value = ((endValue - startValue) * nu[k - 1] / 1000).ToString();

                                    if (value != "0" && value.IndexOf('.') != -1)
                                    {
                                        value += "00";
                                        index = value.IndexOf('.');
                                        value = value.Substring(0, index + 3);
                                    }

                                    sp.AppendFormat("<td width='50px'>{0}</td>", value);
                                }
                            }
                        }
                    }

                    sp.Append("</table>");
                    #endregion

                    #endregion
                }
                else if (repName == "技术经济指标日报表")
                {
                    #region 技术经济指标日报表


                    #region  报表展示

                    if (toExcel == "yes")
                    {
                        sp.Append("<div style='margin-top:30px; width: 100%; font-size: 20px; font-weight: 300;'><br>江苏华电仪征热电有限公司技术经济指标日报表<br><br></div><div style='width: 100%; height: 20px; text-align: left;'>" + date.ToString("yyyy年MM月dd日") + "</div>");
                        sp.Append("<div style='width: 100%;'>");
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX1'>");
                    }
                    else
                    {
                        sp.Append("<div style='width: 100%; font-size: 20px; font-weight: 300;'>江苏华电仪征热电有限公司技术经济指标日报表</div><div style='width: 90%; height: 20px; text-align: left;'>" + date.ToString("yyyy年MM月dd日") + "</div>");
                        sp.Append("<div style='width: 100%;'>");
                        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX'>");
                    }

                    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='2' rowspan='2'>项目</td><td rowspan='2'>单位</td><td rowspan='2' colspan='2'>1#机组</td><td rowspan='2' colspan='2'>2#机组</td><td rowspan='2' colspan='2'>3#机组</td><td rowspan='2'>日累计</td><td colspan='2'>月累计</td></tr><tr bgcolor='#CFE6FC'><td>计划</td><td>完成</td></tr>");


                    #region 计算电量
                    //发电量
                    string[] strEnd = null;
                    string[] strStart = null;
                    double str = 0;

                    //上网电量
                    string[] strH01 = null;
                    string[] strH02 = null;
                    double h01 = 0;
                    double h02 = 0;


                    //发电厂用电量
                    string[] strydl1 = null;
                    string[] strydl2 = null;
                    double strydl = 0;

                    //综合厂用电
                    string[] strzh1 = null;
                    string[] strzh2 = null;

                    //供热量  耗用天然气
                    string[] strgr = null;
                    string[] strhy = null;
                    double strgr1 = 0;
                    double strhy1 = 0;

                    //原气低位热值
                    double yqdwrz = 0;


                    #region 机组1
                    list = drp.RetArrsRepDayInfo(repName, 1, date, isDay);
                    zb = (string[])list[0];//参数
                    un = (string[])list[1];//单位
                    lay = (string[])list[2];//设计值
                    dv = (string[])list[3];//数据
                    dvExcel = (string[])list[4];//原始数据

                    for (int count = 1; count < zb.Length; count++)
                    {
                        if (zb[count] != null && zb[count] != "" && dvExcel[count] != null)
                        {
                            if (zb[count].Trim() == "发电量1")
                            {
                                strEnd = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "发电量2")
                            {
                                strStart = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "上网电量1")
                            {
                                strH01 = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "上网电量2")
                            {
                                strH02 = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "发电厂用电量1")
                            {
                                strydl1 = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "发电厂用电量2")
                            {
                                strydl2 = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "供热量1")
                            {
                                strgr = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "耗用天燃气1")
                            {
                                strhy = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "原气低位热值")
                            {
                                yqdwrz = Convert.ToDouble(dvExcel[count].Split(',')[0]);
                            }
                            else if (zb[count].Trim() == "综合厂用电量1")
                            {
                                strzh1 = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "综合厂用电量2")
                            {
                                strzh2 = dvExcel[count].Split(',');
                            }
                        }
                    }
                    str = ((Convert.ToDouble(strEnd[0]) - Convert.ToDouble(strEnd[1])) + (Convert.ToDouble(strStart[0]) - Convert.ToDouble(strStart[1]))) * 165;
                    h01 = (Convert.ToDouble(strH01[0]) - Convert.ToDouble(strH01[1])) * 440;
                    h02 = (Convert.ToDouble(strH02[0]) - Convert.ToDouble(strH02[1])) * 440;
                    strydl = (Convert.ToDouble(strydl1[0]) - Convert.ToDouble(strydl1[1])) * 10.5 + (Convert.ToDouble(strydl2[0]) - Convert.ToDouble(strydl2[1])) * 0.315;
                    strgr1 = Convert.ToDouble(strgr[0]) * 24 / 1000000;
                    strhy1 = Convert.ToDouble(strhy[0]) * 24 / 10000;

                    double d28 = yqdwrz / 1000;

                    double d6 = str;
                    string d7 = "4H01";
                    string d8 = "";
                    string d9 = "";
                    double d10 = strydl;
                    double d11 = 0;
                    if (d6 != 0)
                        d11 = d10 / d6;
                    double d12 = 0;
                    double d15 = strgr1;
                    double d13 = 0;
                    if (d12 != 0)
                        d13 = d12 / d15 * 100;
                    double d14 = 0;
                    double d16 = strhy1;
                    double d18 = 0;
                    if (d28 != 0)
                        d18 = d15 / d28 / 10;
                    double d17 = d16 - d18;
                    double d19 = 0;
                    if (d6 != 0)
                        d19 = d17 / d6;
                    double d20 = 0;
                    if (d6 - d10 - d12 > 0)
                        d20 = d17 / (d6 - d10 - d12);
                    double d21 = 0;
                    if (d15 != 0)
                        d21 = d18 / d15;
                    double d22 = 0;
                    if (d6 != 0)
                        d22 = d17 * d28 * 1000000 / 29271 / d6;
                    double d23 = 0;
                    if (d6 - d10 - d12 > 0)
                        d23 = d17 * d28 * 1000000 / 29271 / (d6 - d10 - d12);
                    double d24 = 0;
                    if (d15 != 0)
                        d24 = d18 * d28 * 1000000 / 29271 / d15;
                    double d25 = d15 / 3600 * d6;
                    double d26 = 254;
                    double d27 = 0;
                    if (d26 != 0)
                        d27 = d6 * 24 / 1000 / d26 * 1000;

                    string[] jz1 = { d6.ToString("0.00"), d7, d8, d9, d10.ToString("0.00"), d11.ToString("0.00"), d12.ToString("0.00"), d13.ToString("0.00"), d14.ToString("0.00"), d15.ToString("0.00"), d16.ToString("0.00"), d17.ToString("0.00"), d18.ToString("0.00"), d19.ToString("0.00"), d20.ToString("0.00"), d21.ToString("0.00"), d22.ToString("0.00"), d23.ToString("0.00"), d24.ToString("0.00"), d25.ToString("0.00"), d26.ToString("0.00"), d27.ToString("0.00"), d28.ToString("0.00") };
                    #endregion

                    #region 机组2
                    list = drp.RetArrsRepDayInfo(repName, 2, date, isDay);

                    dvExcel = (string[])list[4];//原始数据
                    //发电量
                    strEnd = null;
                    strStart = null;
                    str = 0;

                    //上网电量
                    strH01 = null;
                    strH02 = null;
                    h01 = 0;
                    h02 = 0;


                    //发电厂用电量
                    strydl1 = null;
                    strydl2 = null;
                    strydl = 0;

                    //综合厂用电
                    strzh1 = null;
                    strzh2 = null;

                    //供热量  耗用天然气
                    strgr = null;
                    strhy = null;
                    strgr1 = 0;
                    strhy1 = 0;

                    //原气低位热值
                    yqdwrz = 0;

                    for (int count = 1; count < zb.Length; count++)
                    {
                        if (zb[count] != null && zb[count] != "" && dvExcel[count] != null)
                        {
                            if (zb[count].Trim() == "发电量3")
                            {
                                strEnd = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "发电量4")
                            {
                                strStart = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "上网电量3")
                            {
                                strH01 = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "上网电量4")
                            {
                                strH02 = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "发电厂用电量3")
                            {
                                strydl1 = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "发电厂用电量4")
                            {
                                strydl2 = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "供热量2")
                            {
                                strgr = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "耗用天燃气2")
                            {
                                strhy = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "原气低位热值")
                            {
                                yqdwrz = Convert.ToDouble(dvExcel[count].Split(',')[0]);
                            }
                        }
                    }
                    if (strEnd != null && strStart != null)
                        str = ((Convert.ToDouble(strEnd[0]) - Convert.ToDouble(strEnd[1])) + (Convert.ToDouble(strStart[0]) - Convert.ToDouble(strStart[1]))) * 165;
                    if (strH01 != null)
                        h01 = (Convert.ToDouble(strH01[0]) - Convert.ToDouble(strH01[1])) * 440;
                    if (strH02 != null)
                        h02 = (Convert.ToDouble(strH02[0]) - Convert.ToDouble(strH02[1])) * 440;
                    if (strydl1 != null && strydl2 != null)
                        strydl = (Convert.ToDouble(strydl1[0]) - Convert.ToDouble(strydl1[1])) * 10.5 + (Convert.ToDouble(strydl2[0]) - Convert.ToDouble(strydl2[1])) * 0.315;
                    if (strgr != null)
                        strgr1 = Convert.ToDouble(strgr[0]) * 24 / 1000000;
                    if (strhy != null)
                        strhy1 = Convert.ToDouble(strhy[0]) * 24 / 10000;

                    d28 = yqdwrz / 1000;

                    d6 = str;
                    d7 = "4H01";
                    d8 = "";
                    d9 = "";
                    d10 = strydl;
                    d11 = 0;
                    if (d6 != 0)
                        d11 = d10 / d6;
                    d12 = 0;
                    d15 = strgr1;
                    d13 = 0;
                    if (d12 != 0)
                        d13 = d12 / d15 * 100;
                    d14 = 0;
                    d16 = strhy1;
                    d18 = 0;
                    if (d28 != 0)
                        d18 = d15 / d28 / 10;
                    d17 = d16 - d18;
                    d19 = 0;
                    if (d6 != 0)
                        d19 = d17 / d6;
                    d20 = 0;
                    if (d6 - d10 - d12 > 0)
                        d20 = d17 / (d6 - d10 - d12);
                    d21 = 0;
                    if (d15 != 0)
                        d21 = d18 / d15;
                    d22 = 0;
                    if (d6 != 0)
                        d22 = d17 * d28 * 1000000 / 29271 / d6;
                    d23 = 0;
                    if (d6 - d10 - d12 > 0)
                        d23 = d17 * d28 * 1000000 / 29271 / (d6 - d10 - d12);
                    d24 = 0;
                    if (d15 != 0)
                        d24 = d18 * d28 * 1000000 / 29271 / d15;
                    d25 = d15 / 3600 * d6;
                    d26 = 254;
                    d27 = 0;
                    if (d26 != 0)
                        d27 = d6 * 24 / 1000 / d26 * 1000;

                    string[] jz2 = { d6.ToString("0.00"), d7, d8, d9, d10.ToString("0.00"), d11.ToString("0.00"), d12.ToString("0.00"), d13.ToString("0.00"), d14.ToString("0.00"), d15.ToString("0.00"), d16.ToString("0.00"), d17.ToString("0.00"), d18.ToString("0.00"), d19.ToString("0.00"), d20.ToString("0.00"), d21.ToString("0.00"), d22.ToString("0.00"), d23.ToString("0.00"), d24.ToString("0.00"), d25.ToString("0.00"), d26.ToString("0.00"), d27.ToString("0.00"), d28.ToString("0.00") };
                    #endregion

                    #region 机组3
                    list = drp.RetArrsRepDayInfo(repName, 3, date, isDay);

                    dvExcel = (string[])list[4];//原始数据
                    //发电量
                    strEnd = null;
                    strStart = null;
                    str = 0;

                    //上网电量
                    strH01 = null;
                    strH02 = null;
                    h01 = 0;
                    h02 = 0;


                    //发电厂用电量
                    strydl1 = null;
                    strydl2 = null;
                    strydl = 0;

                    //综合厂用电
                    strzh1 = null;
                    strzh2 = null;

                    //供热量  耗用天然气
                    strgr = null;
                    strhy = null;
                    strgr1 = 0;
                    strhy1 = 0;

                    //原气低位热值
                    yqdwrz = 0;

                    for (int count = 1; count < zb.Length; count++)
                    {
                        if (zb[count] != null && zb[count] != "" && dvExcel[count] != null)
                        {
                            if (zb[count].Trim() == "发电量5")
                            {
                                strEnd = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "发电量6")
                            {
                                strStart = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "上网电量5")
                            {
                                strH01 = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "上网电量6")
                            {
                                strH02 = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "发电厂用电量5")
                            {
                                strydl1 = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "发电厂用电量6")
                            {
                                strydl2 = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "供热量3")
                            {
                                strgr = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "耗用天燃气3")
                            {
                                strhy = dvExcel[count].Split(',');
                            }
                            else if (zb[count].Trim() == "原气低位热值")
                            {
                                yqdwrz = Convert.ToDouble(dvExcel[count].Split(',')[0]);
                            }
                        }
                    }
                    if (strEnd != null && strStart != null)
                        str = ((Convert.ToDouble(strEnd[0]) - Convert.ToDouble(strEnd[1])) + (Convert.ToDouble(strStart[0]) - Convert.ToDouble(strStart[1]))) * 165;
                    if (strH01 != null)
                        h01 = (Convert.ToDouble(strH01[0]) - Convert.ToDouble(strH01[1])) * 440;
                    if (strH02 != null)
                        h02 = (Convert.ToDouble(strH02[0]) - Convert.ToDouble(strH02[1])) * 440;
                    if (strydl1 != null && strydl2 != null)
                        strydl = (Convert.ToDouble(strydl1[0]) - Convert.ToDouble(strydl1[1])) * 10.5 + (Convert.ToDouble(strydl2[0]) - Convert.ToDouble(strydl2[1])) * 0.315;
                    if (strgr != null)
                        strgr1 = Convert.ToDouble(strgr[0]) * 24 / 1000000;
                    if (strhy != null)
                        strhy1 = Convert.ToDouble(strhy[0]) * 24 / 10000;

                    d28 = yqdwrz / 1000;
                    d6 = str;
                    d7 = "4H02";
                    d8 = "";
                    d9 = "";
                    d10 = strydl;
                    d11 = 0;
                    if (d6 != 0)
                        d11 = d10 / d6;
                    d12 = 0;
                    d15 = strgr1;
                    d13 = 0;
                    if (d12 != 0)
                        d13 = d12 / d15 * 100;
                    d14 = 0;
                    d16 = strhy1;
                    d18 = 0;
                    if (d28 != 0)
                        d18 = d15 / d28 / 10;
                    d17 = d16 - d18;
                    d19 = 0;
                    if (d6 != 0)
                        d19 = d17 / d6;
                    d20 = 0;
                    if (d6 - d10 - d12 > 0)
                        d20 = d17 / (d6 - d10 - d12);
                    d21 = 0;
                    if (d15 != 0)
                        d21 = d18 / d15;
                    d22 = 0;
                    if (d6 != 0)
                        d22 = d17 * d28 * 1000000 / 29271 / d6;
                    d23 = 0;
                    if (d6 - d10 - d12 > 0)
                        d23 = d17 * d28 * 1000000 / 29271 / (d6 - d10 - d12);
                    d24 = 0;
                    if (d15 != 0)
                        d24 = d18 * d28 * 1000000 / 29271 / d15;
                    d25 = d15 / 3600 * d6;
                    d26 = 254;
                    d27 = 0;
                    if (d26 != 0)
                        d27 = d6 * 24 / 1000 / d26 * 1000;

                    string[] jz3 = { d6.ToString("0.00"), d7, d8, d9, d10.ToString("0.00"), d11.ToString("0.00"), d12.ToString("0.00"), d13.ToString("0.00"), d14.ToString("0.00"), d15.ToString("0.00"), d16.ToString("0.00"), d17.ToString("0.00"), d18.ToString("0.00"), d19.ToString("0.00"), d20.ToString("0.00"), d21.ToString("0.00"), d22.ToString("0.00"), d23.ToString("0.00"), d24.ToString("0.00"), d25.ToString("0.00"), d26.ToString("0.00"), d27.ToString("0.00"), d28.ToString("0.00") };
                    #endregion


                    d6 = Convert.ToDouble(jz1[0]) + Convert.ToDouble(jz2[0]) + Convert.ToDouble(jz3[0]);
                    d7 = (h01 + h02).ToString("0.00");
                    double res1 = 0;
                    double res = 0;
                    if (strzh1 == null)
                        res = d6 - Convert.ToDouble(d7);
                    else
                        res = d6 - Convert.ToDouble(d7) - ((Convert.ToDouble(strzh1[0]) - Convert.ToDouble(strzh1[1])) + (Convert.ToDouble(strzh2[0]) - Convert.ToDouble(strzh2[1]))) * 440;
                    d8 = res.ToString("0.00");
                    if (d6 != 0)
                        d9 = (res / d6).ToString("0.00");
                    else
                        d9 = "";
                    d10 = Convert.ToDouble(jz1[4]) + Convert.ToDouble(jz2[4]) + Convert.ToDouble(jz3[4]);
                    d11 = 0;
                    if (d6 != 0)
                        d11 = d10 / d6;
                    d12 = 0;
                    d13 = 0;
                    d14 = 0;

                    d15 = Convert.ToDouble(jz1[9]) + Convert.ToDouble(jz2[9]) + Convert.ToDouble(jz3[9]);
                    d16 = Convert.ToDouble(jz1[10]) + Convert.ToDouble(jz2[10]) + Convert.ToDouble(jz3[10]);
                    d17 = Convert.ToDouble(jz1[11]) + Convert.ToDouble(jz2[11]) + Convert.ToDouble(jz3[11]); ;
                    d18 = Convert.ToDouble(jz1[12]) + Convert.ToDouble(jz2[12]) + Convert.ToDouble(jz3[12]);

                    d19 = 0;
                    if (d6 != 0)
                        d19 = d17 / d6;
                    d20 = 0;
                    if (d7 != "" && Convert.ToDouble(d7) != 0)
                        d20 = d17 / Convert.ToDouble(d7);
                    d21 = 0;
                    if (d15 != 0)
                        d21 = d18 / d15;
                    d22 = 0;
                    if (d6 != 0)
                        d22 = d17 * d28 * 1000000 / 29271 / d6;
                    d23 = 0;
                    if (d7 != "" && Convert.ToDouble(d7) != 0)
                        d23 = d17 * d28 * 1000000 / 29271 / Convert.ToDouble(d7);
                    d24 = 0;
                    if (d15 != 0)
                        d24 = d18 * d28 * 1000000 / 29271 / d15;
                    d25 = d15 / 3600 * d6;
                    d26 = 254;
                    d27 = 0;
                    if (d26 != 0)
                        d27 = d6 * 24 / 1000 / d26 * 1000;

                    string[] jzSum = { d6.ToString("0.00"), d7, d8, d9, d10.ToString("0.00"), d11.ToString("0.00"), d12.ToString("0.00"), d13.ToString("0.00"), d14.ToString("0.00"), d15.ToString("0.00"), d16.ToString("0.00"), d17.ToString("0.00"), d18.ToString("0.00"), d19.ToString("0.00"), d20.ToString("0.00"), d21.ToString("0.00"), d22.ToString("0.00"), d23.ToString("0.00"), d24.ToString("0.00"), d25.ToString("0.00"), d26.ToString("0.00"), d27.ToString("0.00"), d28.ToString("0.00") };

                    #endregion
                    int num = 0;

                    for (int i = 1; i < un.Length; i++)
                    {
                        if (un[i] != null && un[i] != "")
                        {
                            sp.Append("<tr>");
                            if (zb[i] == "发电")
                            {
                                num++;
                                sp.Append("<td rowspan='2'>其中</td>");
                                sp.AppendFormat("<td>{0}</td>", zb[i]);
                            }
                            else if (zb[i - 1] == "发电")
                            {
                                num++;
                                sp.AppendFormat("<td>{0}</td>", zb[i]);
                            }
                            else
                            {
                                num++;
                                sp.AppendFormat("<td colspan='2'>{0}</td>", zb[i]);
                            }

                            sp.AppendFormat("<td>{0}</td>", un[i]);

                            if (num - 1 < jz1.Length)
                            {

                                if (zb[i] == "上网电量")
                                {
                                    sp.AppendFormat("<td>{0}</td>", jz1[num - 1]);
                                    sp.AppendFormat("<td colspan='2'>{0}</td>", h01);
                                    sp.AppendFormat("<td>{0}</td>", jz3[num - 1]);
                                    sp.AppendFormat("<td colspan='2'>{0}</td>", h02);
                                    sp.AppendFormat("<td>{0}</td>", jzSum[num - 1]);
                                    sp.Append("<td>&nbsp;</td>");
                                    sp.Append("<td>&nbsp;</td>");
                                }
                                else if (zb[i] == "综合厂用电量" || zb[i] == "综合厂用电率")
                                {
                                    sp.Append("<td colspan='6'>&nbsp;—</td>");
                                    sp.AppendFormat("<td>{0}</td>", jzSum[num - 1]);
                                    sp.Append("<td>&nbsp;</td>");
                                    sp.Append("<td>&nbsp;</td>");
                                }
                                else if (zb[i] == "供热厂用电量" || zb[i] == "供热厂用电耗")
                                {
                                    sp.Append("<td colspan='2'>&nbsp;</td>");
                                    sp.Append("<td colspan='2'>&nbsp;</td>");
                                    sp.Append("<td colspan='2'>&nbsp;</td>");
                                    sp.AppendFormat("<td>{0}</td>", jzSum[num - 1]);
                                    sp.Append("<td>&nbsp;</td>");
                                    sp.Append("<td>&nbsp;</td>");
                                }
                                else if (zb[i] == "运行小时数")
                                {
                                    sp.Append("<td>&nbsp;</td>");
                                    sp.Append("<td>&nbsp;</td>");
                                    sp.Append("<td>&nbsp;</td>");
                                    sp.Append("<td>&nbsp;</td>");
                                    sp.Append("<td>&nbsp;</td>");
                                    sp.Append("<td>&nbsp;</td>");
                                    sp.AppendFormat("<td>{0}</td>", jzSum[num - 1]);
                                    sp.Append("<td>&nbsp;</td>");
                                    sp.Append("<td>&nbsp;</td>");
                                }
                                else if (zb[i] == "原气低位热值")
                                {
                                    sp.AppendFormat("<td colspan='9'>{0}</td>", jz1[num - 1]);
                                }
                                else
                                {
                                    sp.AppendFormat("<td colspan='2'>{0}</td>", jz1[num - 1]);
                                    sp.AppendFormat("<td colspan='2'>{0}</td>", jz2[num - 1]);
                                    sp.AppendFormat("<td colspan='2'>{0}</td>", jz3[num - 1]);
                                    sp.AppendFormat("<td>{0}</td>", jzSum[num - 1]);
                                    sp.Append("<td>&nbsp;</td>");
                                    sp.Append("<td>&nbsp;</td>");
                                }

                            }

                            sp.Append("</tr>");
                        }
                    }

                    sp.Append("</table>");
                    sp.Append("</div>");
                    sp.Append("</div>");
                    #endregion

                    #region 导出Excel

                    //#region  报表展示

                    //if (toExcel == "no")
                    //{
                    //    sp.Append("<div style='display:none;width: 100%; font-size: 20px; font-weight: 300;'>江苏华电仪征热电有限公司技术经济指标日报表</div><div style='display:none;width: 90%; height: 20px; text-align: left;'>" + date.ToString("yyyy年MM月dd日") + "</div>");
                    //    sp.Append("<div style='display:none;width: 100%;'>");
                    //    sp.Append("<table style='display:none;' border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX'>");
                    //}
                    //else
                    //{
                    //    sp.Append("<div style='display:none;width: 100%; font-size: 20px; font-weight: 300;'>江苏华电仪征热电有限公司技术经济指标日报表</div><div style='display:none;width: 90%; height: 20px; text-align: left;'>" + date.ToString("yyyy年MM月dd日") + "</div>");
                    //    sp.Append("<div style='display:none;width: 100%;'>");
                    //    sp.Append("<table style='display:none;' border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX1'>");
                    //}

                    //sp.Append("<tr bgcolor='#CFE6FC'><td colspan='2' rowspan='2'>项目</td><td rowspan='2'>单位</td><td rowspan='2' colspan='2'>1#机组</td><td rowspan='2' colspan='2'>2#机组</td><td rowspan='2' colspan='2'>3#机组</td><td rowspan='2'>日累计</td><td colspan='2'>月累计</td></tr><tr bgcolor='#CFE6FC'><td>计划</td><td>完成</td></tr>");


                    //#region 计算电量



                    //#region 机组1
                    //list = drp.RetArrsRepDayInfo(repName, 1, date, isDay);
                    //zb = (string[])list[0];//参数
                    //un = (string[])list[1];//单位
                    //lay = (string[])list[2];//设计值
                    //dv = (string[])list[3];//数据
                    //dvExcel = (string[])list[4];//原始数据

                    //for (int count = 1; count < zb.Length; count++)
                    //{
                    //    if (zb[count] != null && zb[count] != "" && dvExcel[count] != null)
                    //    {
                    //        if (zb[count].Trim() == "发电量1")
                    //        {
                    //            strEnd = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "发电量2")
                    //        {
                    //            strStart = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "上网电量1")
                    //        {
                    //            strH01 = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "上网电量2")
                    //        {
                    //            strH02 = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "发电厂用电量1")
                    //        {
                    //            strydl1 = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "发电厂用电量2")
                    //        {
                    //            strydl2 = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "供热量1")
                    //        {
                    //            strgr = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "耗用天燃气1")
                    //        {
                    //            strhy = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "原气低位热值")
                    //        {
                    //            yqdwrz = Convert.ToDouble(dvExcel[count].Split(',')[0]);
                    //        }
                    //        else if (zb[count].Trim() == "综合厂用电量1")
                    //        {
                    //            strzh1 = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "综合厂用电量2")
                    //        {
                    //            strzh2 = dvExcel[count].Split(',');
                    //        }
                    //    }
                    //}
                    //str = ((Convert.ToDouble(strEnd[0]) - Convert.ToDouble(strEnd[1])) + (Convert.ToDouble(strStart[0]) - Convert.ToDouble(strStart[1]))) * 165;
                    //h01 = (Convert.ToDouble(strH01[0]) - Convert.ToDouble(strH01[1])) * 440;
                    //h02 = (Convert.ToDouble(strH02[0]) - Convert.ToDouble(strH02[1])) * 440;
                    //strydl = (Convert.ToDouble(strydl1[0]) - Convert.ToDouble(strydl1[1])) * 10.5 + (Convert.ToDouble(strydl2[0]) - Convert.ToDouble(strydl2[1])) * 0.315;
                    //strgr1 = Convert.ToDouble(strgr[0]) / 1000000;
                    //strhy1 = Convert.ToDouble(strhy[0]) / 10000;

                    //d28 = yqdwrz;

                    //d6 = str;
                    //d7 = "4H01";
                    //d8 = "";
                    //d9 = "";
                    //d10 = strydl;
                    //d11 = 0;
                    //if (d6 != 0)
                    //    d11 = d10 / d6;
                    //d12 = 0;
                    //d15 = strgr1;
                    //d13 = 0;
                    //if (d12 != 0)
                    //    d13 = d12 / d15 * 100;
                    //d14 = 0;
                    //d16 = strhy1;
                    //d18 = 0;
                    //if (d28 != 0)
                    //    d18 = d15 / d28 * 100;
                    //d17 = d16 - d18;
                    //d19 = 0;
                    //if (d6 != 0)
                    //    d19 = d17 / d6;
                    //d20 = 0;
                    //if (d6 - d10 - d12 > 0)
                    //    d20 = d17 / (d6 - d10 - d12);
                    //d21 = 0;
                    //if (d15 != 0)
                    //    d21 = d18 / d15;
                    //d22 = 0;
                    //if (d6 != 0)
                    //    d22 = d17 * d28 * 1000000 / 29271 / d6;
                    //d23 = 0;
                    //if (d6 - d10 - d12 > 0)
                    //    d23 = d17 * d28 * 1000000 / 29271 / (d6 - d10 - d12);
                    //d24 = 0;
                    //if (d15 != 0)
                    //    d24 = d18 * d28 * 1000000 / 29271 / d15;
                    //d25 = d15 / 3600 * d6;
                    //d26 = 254;
                    //d27 = 0;
                    //if (d26 != 0)
                    //    d27 = d6 * 24 / 1000 / d26 * 1000;

                    //string[] jz4 = { d6.ToString("0.00"), d7, d8, d9, d10.ToString("0.00"), d11.ToString("0.00"), d12.ToString("0.00"), d13.ToString("0.00"), d14.ToString("0.00"), d15.ToString("0.00"), d16.ToString("0.00"), d17.ToString("0.00"), d18.ToString("0.00"), d19.ToString("0.00"), d20.ToString("0.00"), d21.ToString("0.00"), d22.ToString("0.00"), d23.ToString("0.00"), d24.ToString("0.00"), d25.ToString("0.00"), d26.ToString("0.00"), d27.ToString("0.00"), d28.ToString("0.00") };
                    //#endregion

                    //#region 机组2
                    //list = drp.RetArrsRepDayInfo(repName, 2, date, isDay);

                    //dvExcel = (string[])list[4];//原始数据

                    //for (int count = 1; count < zb.Length; count++)
                    //{
                    //    if (zb[count] != null && zb[count] != "" && dvExcel[count] != null)
                    //    {
                    //        if (zb[count].Trim() == "发电量3")
                    //        {
                    //            strEnd = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "发电量4")
                    //        {
                    //            strStart = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "上网电量3")
                    //        {
                    //            strH01 = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "上网电量4")
                    //        {
                    //            strH02 = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "发电厂用电量3")
                    //        {
                    //            strydl1 = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "发电厂用电量4")
                    //        {
                    //            strydl2 = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "供热量2")
                    //        {
                    //            strgr = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "耗用天燃气2")
                    //        {
                    //            strhy = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "原气低位热值")
                    //        {
                    //            yqdwrz = Convert.ToDouble(dvExcel[count].Split(',')[0]);
                    //        }
                    //    }
                    //}
                    //str = ((Convert.ToDouble(strEnd[0]) - Convert.ToDouble(strEnd[1])) + (Convert.ToDouble(strStart[0]) - Convert.ToDouble(strStart[1]))) * 165;
                    //h01 = (Convert.ToDouble(strH01[0]) - Convert.ToDouble(strH01[1])) * 440;
                    //h02 = (Convert.ToDouble(strH02[0]) - Convert.ToDouble(strH02[1])) * 440;
                    //strydl = (Convert.ToDouble(strydl1[0]) - Convert.ToDouble(strydl1[1])) * 10.5 + (Convert.ToDouble(strydl2[0]) - Convert.ToDouble(strydl2[1])) * 0.315;
                    //strgr1 = Convert.ToDouble(strgr[0]) / 1000000;
                    //strhy1 = Convert.ToDouble(strhy[0]) / 10000;

                    //d28 = yqdwrz;

                    //d6 = str;
                    //d7 = "4H01";
                    //d8 = "";
                    //d9 = "";
                    //d10 = strydl;
                    //d11 = 0;
                    //if (d6 != 0)
                    //    d11 = d10 / d6;
                    //d12 = 0;
                    //d15 = strgr1;
                    //d13 = 0;
                    //if (d12 != 0)
                    //    d13 = d12 / d15 * 100;
                    //d14 = 0;
                    //d16 = strhy1;
                    //d18 = 0;
                    //if (d28 != 0)
                    //    d18 = d15 / d28 * 100;
                    //d17 = d16 - d18;
                    //d19 = 0;
                    //if (d6 != 0)
                    //    d19 = d17 / d6;
                    //d20 = 0;
                    //if (d6 - d10 - d12 > 0)
                    //    d20 = d17 / (d6 - d10 - d12);
                    //d21 = 0;
                    //if (d15 != 0)
                    //    d21 = d18 / d15;
                    //d22 = 0;
                    //if (d6 != 0)
                    //    d22 = d17 * d28 * 1000000 / 29271 / d6;
                    //d23 = 0;
                    //if (d6 - d10 - d12 > 0)
                    //    d23 = d17 * d28 * 1000000 / 29271 / (d6 - d10 - d12);
                    //d24 = 0;
                    //if (d15 != 0)
                    //    d24 = d18 * d28 * 1000000 / 29271 / d15;
                    //d25 = d15 / 3600 * d6;
                    //d26 = 254;
                    //d27 = 0;
                    //if (d26 != 0)
                    //    d27 = d6 * 24 / 1000 / d26 * 1000;

                    //string[] jz5 = { d6.ToString("0.00"), d7, d8, d9, d10.ToString("0.00"), d11.ToString("0.00"), d12.ToString("0.00"), d13.ToString("0.00"), d14.ToString("0.00"), d15.ToString("0.00"), d16.ToString("0.00"), d17.ToString("0.00"), d18.ToString("0.00"), d19.ToString("0.00"), d20.ToString("0.00"), d21.ToString("0.00"), d22.ToString("0.00"), d23.ToString("0.00"), d24.ToString("0.00"), d25.ToString("0.00"), d26.ToString("0.00"), d27.ToString("0.00"), d28.ToString("0.00") };
                    //#endregion

                    //#region 机组3
                    //list = drp.RetArrsRepDayInfo(repName, 3, date, isDay);

                    //dvExcel = (string[])list[4];//原始数据

                    //for (int count = 1; count < zb.Length; count++)
                    //{
                    //    if (zb[count] != null && zb[count] != "" && dvExcel[count] != null)
                    //    {
                    //        if (zb[count].Trim() == "发电量5")
                    //        {
                    //            strEnd = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "发电量6")
                    //        {
                    //            strStart = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "上网电量5")
                    //        {
                    //            strH01 = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "上网电量6")
                    //        {
                    //            strH02 = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "发电厂用电量5")
                    //        {
                    //            strydl1 = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "发电厂用电量6")
                    //        {
                    //            strydl2 = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "供热量3")
                    //        {
                    //            strgr = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "耗用天燃气3")
                    //        {
                    //            strhy = dvExcel[count].Split(',');
                    //        }
                    //        else if (zb[count].Trim() == "原气低位热值")
                    //        {
                    //            yqdwrz = Convert.ToDouble(dvExcel[count].Split(',')[0]);
                    //        }
                    //    }
                    //}
                    //str = ((Convert.ToDouble(strEnd[0]) - Convert.ToDouble(strEnd[1])) + (Convert.ToDouble(strStart[0]) - Convert.ToDouble(strStart[1]))) * 165;
                    //h01 = (Convert.ToDouble(strH01[0]) - Convert.ToDouble(strH01[1])) * 440;
                    //h02 = (Convert.ToDouble(strH02[0]) - Convert.ToDouble(strH02[1])) * 440;
                    //strydl = (Convert.ToDouble(strydl1[0]) - Convert.ToDouble(strydl1[1])) * 10.5 + (Convert.ToDouble(strydl2[0]) - Convert.ToDouble(strydl2[1])) * 0.315;
                    //strgr1 = Convert.ToDouble(strgr[0]) / 1000000;
                    //strhy1 = Convert.ToDouble(strhy[0]) / 10000;

                    //d28 = yqdwrz;
                    //d6 = str;
                    //d7 = "4H02";
                    //d8 = "";
                    //d9 = "";
                    //d10 = strydl;
                    //d11 = 0;
                    //if (d6 != 0)
                    //    d11 = d10 / d6;
                    //d12 = 0;
                    //d15 = strgr1;
                    //d13 = 0;
                    //if (d12 != 0)
                    //    d13 = d12 / d15 * 100;
                    //d14 = 0;
                    //d16 = strhy1;
                    //d18 = 0;
                    //if (d28 != 0)
                    //    d18 = d15 / d28 * 100;
                    //d17 = d16 - d18;
                    //d19 = 0;
                    //if (d6 != 0)
                    //    d19 = d17 / d6;
                    //d20 = 0;
                    //if (d6 - d10 - d12 > 0)
                    //    d20 = d17 / (d6 - d10 - d12);
                    //d21 = 0;
                    //if (d15 != 0)
                    //    d21 = d18 / d15;
                    //d22 = 0;
                    //if (d6 != 0)
                    //    d22 = d17 * d28 * 1000000 / 29271 / d6;
                    //d23 = 0;
                    //if (d6 - d10 - d12 > 0)
                    //    d23 = d17 * d28 * 1000000 / 29271 / (d6 - d10 - d12);
                    //d24 = 0;
                    //if (d15 != 0)
                    //    d24 = d18 * d28 * 1000000 / 29271 / d15;
                    //d25 = d15 / 3600 * d6;
                    //d26 = 254;
                    //d27 = 0;
                    //if (d26 != 0)
                    //    d27 = d6 * 24 / 1000 / d26 * 1000;

                    //string[] jz6 = { d6.ToString("0.00"), d7, d8, d9, d10.ToString("0.00"), d11.ToString("0.00"), d12.ToString("0.00"), d13.ToString("0.00"), d14.ToString("0.00"), d15.ToString("0.00"), d16.ToString("0.00"), d17.ToString("0.00"), d18.ToString("0.00"), d19.ToString("0.00"), d20.ToString("0.00"), d21.ToString("0.00"), d22.ToString("0.00"), d23.ToString("0.00"), d24.ToString("0.00"), d25.ToString("0.00"), d26.ToString("0.00"), d27.ToString("0.00"), d28.ToString("0.00") };
                    //#endregion


                    //d6 = Convert.ToDouble(jz4[0]) + Convert.ToDouble(jz5[0]) + Convert.ToDouble(jz6[0]);
                    //d7 = (h01 + h02).ToString("0.00");
                    //res = d6 - Convert.ToDouble(d7) - ((Convert.ToDouble(strzh1[0]) - Convert.ToDouble(strzh1[1])) + (Convert.ToDouble(strzh2[0]) - Convert.ToDouble(strzh2[1]))) * 440;
                    //d8 = res.ToString("0.00");
                    //if (d6 != 0)
                    //    d9 = (res / d6).ToString("0.00");
                    //else
                    //    d9 = "";
                    //d10 = Convert.ToDouble(jz4[4]) + Convert.ToDouble(jz5[4]) + Convert.ToDouble(jz6[4]);
                    //d11 = 0;
                    //if (d6 != 0)
                    //    d11 = d10 / d6;
                    //d12 = 0;
                    //d13 = 0;
                    //d14 = 0;

                    //d15 = Convert.ToDouble(jz4[9]) + Convert.ToDouble(jz5[9]) + Convert.ToDouble(jz6[9]);
                    //d16 = Convert.ToDouble(jz4[10]) + Convert.ToDouble(jz5[10]) + Convert.ToDouble(jz6[10]);
                    //d17 = Convert.ToDouble(jz4[11]) + Convert.ToDouble(jz5[11]) + Convert.ToDouble(jz6[11]); ;
                    //d18 = Convert.ToDouble(jz4[12]) + Convert.ToDouble(jz5[12]) + Convert.ToDouble(jz6[12]);

                    //d19 = 0;
                    //if (d6 != 0)
                    //    d19 = d17 / d6;
                    //d20 = 0;
                    //if (d7 != "" && Convert.ToDouble(d7) != 0)
                    //    d20 = d17 / Convert.ToDouble(d7);
                    //d21 = 0;
                    //if (d15 != 0)
                    //    d21 = d18 / d15;
                    //d22 = 0;
                    //if (d6 != 0)
                    //    d22 = d17 * d28 * 1000000 / 29271 / d6;
                    //d23 = 0;
                    //if (d7 != "" && Convert.ToDouble(d7) != 0)
                    //    d23 = d17 * d28 * 1000000 / 29271 / Convert.ToDouble(d7);
                    //d24 = 0;
                    //if (d15 != 0)
                    //    d24 = d18 * d28 * 1000000 / 29271 / d15;
                    //d25 = d15 / 3600 * d6;
                    //d26 = 254;
                    //d27 = 0;
                    //if (d26 != 0)
                    //    d27 = d6 * 24 / 1000 / d26 * 1000;

                    //string[] jzSum1 = { d6.ToString("0.00"), d7, d8, d9, d10.ToString("0.00"), d11.ToString(), d12.ToString(), d13.ToString(), d14.ToString(), d15.ToString(), d16.ToString(), d17.ToString(), d18.ToString(), d19.ToString(), d20.ToString(), d21.ToString(), d22.ToString(), d23.ToString(), d24.ToString(), d25.ToString(), d26.ToString(), d27.ToString("0.00"), d28.ToString("0.00") };

                    //#endregion

                    //for (int i = 1; i < un.Length; i++)
                    //{
                    //    if (un[i] != null && un[i] != "")
                    //    {
                    //        sp.Append("<tr>");
                    //        if (zb[i] == "发电")
                    //        {
                    //            num++;
                    //            sp.Append("<td rowspan='2'>其中</td>");
                    //            sp.AppendFormat("<td>{0}</td>", zb[i]);
                    //        }
                    //        else if (zb[i - 1] == "发电")
                    //        {
                    //            num++;
                    //            sp.AppendFormat("<td>{0}</td>", zb[i]);
                    //        }
                    //        else
                    //        {
                    //            num++;
                    //            sp.AppendFormat("<td colspan='2'>{0}</td>", zb[i]);
                    //        }

                    //        sp.AppendFormat("<td>{0}</td>", un[i]);

                    //        if (num - 1 < jz1.Length)
                    //        {

                    //            if (zb[i] == "上网电量")
                    //            {
                    //                sp.AppendFormat("<td>{0}</td>", jz4[num - 1]);
                    //                sp.AppendFormat("<td colspan='2'>{0}</td>", h01);
                    //                sp.AppendFormat("<td>{0}</td>", jz6[num - 1]);
                    //                sp.AppendFormat("<td colspan='2'>{0}</td>", h02);
                    //                sp.AppendFormat("<td>{0}</td>", jzSum[num - 1]);
                    //                sp.Append("<td>&nbsp;</td>");
                    //                sp.Append("<td>&nbsp;</td>");
                    //            }
                    //            else if (zb[i] == "综合厂用电量" || zb[i] == "综合厂用电率")
                    //            {
                    //                sp.Append("<td colspan='6'>&nbsp;—</td>");
                    //                sp.AppendFormat("<td>{0}</td>", jzSum1[num - 1]);
                    //                sp.Append("<td>&nbsp;</td>");
                    //                sp.Append("<td>&nbsp;</td>");
                    //            }
                    //            else if (zb[i] == "供热厂用电量" || zb[i] == "供热厂用电耗")
                    //            {
                    //                sp.Append("<td colspan='2'>&nbsp;</td>");
                    //                sp.Append("<td colspan='2'>&nbsp;</td>");
                    //                sp.Append("<td colspan='2'>&nbsp;</td>");
                    //                sp.AppendFormat("<td>{0}</td>", jzSum1[num - 1]);
                    //                sp.Append("<td>&nbsp;</td>");
                    //                sp.Append("<td>&nbsp;</td>");
                    //            }
                    //            else if (zb[i] == "运行小时数")
                    //            {
                    //                sp.Append("<td>&nbsp;</td>");
                    //                sp.Append("<td>&nbsp;</td>");
                    //                sp.Append("<td>&nbsp;</td>");
                    //                sp.Append("<td>&nbsp;</td>");
                    //                sp.Append("<td>&nbsp;</td>");
                    //                sp.Append("<td>&nbsp;</td>");
                    //                sp.AppendFormat("<td>{0}</td>", jzSum1[num - 1]);
                    //                sp.Append("<td>&nbsp;</td>");
                    //                sp.Append("<td>&nbsp;</td>");
                    //            }
                    //            else if (zb[i] == "原气低位热值")
                    //            {
                    //                sp.AppendFormat("<td colspan='9'>{0}</td>", jz4[num - 1]);
                    //            }
                    //            else
                    //            {
                    //                sp.AppendFormat("<td colspan='2'>{0}</td>", jz4[num - 1]);
                    //                sp.AppendFormat("<td colspan='2'>{0}</td>", jz5[num - 1]);
                    //                sp.AppendFormat("<td colspan='2'>{0}</td>", jz6[num - 1]);
                    //                sp.AppendFormat("<td>{0}</td>", jzSum1[num - 1]);
                    //                sp.Append("<td>&nbsp;</td>");
                    //                sp.Append("<td>&nbsp;</td>");
                    //            }

                    //        }

                    //        sp.Append("</tr>");
                    //    }
                    //}

                    //sp.Append("</table>");
                    //sp.Append("</div>");
                    //sp.Append("</div>");
                    //#endregion

                    #endregion

                    #endregion
                }

                #endregion

                //#region 5张常用报表
                //if (repName == "燃机主要参数日报表" || repName == "全厂综合指标日报表")
                //{
                //    if (toExcel == "yes")
                //        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX'>");
                //    else
                //        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX1'>");
                //    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='15'>" + repName + "</td></tr>");

                //    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='2'>时间</td><td>名称</td>");
                //    for (int i = 1; i < zb.Length; i++)
                //    {
                //        sp.AppendFormat("<td>{0}</td>", zb[i]);
                //    }
                //    sp.Append("</tr>");


                //    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                //    for (int i = 1; i < un.Length; i++)
                //    {
                //        sp.AppendFormat("<td>{0}</td>", un[i]);
                //    }
                //    sp.Append("</tr>");

                //    sp.Append("<tr>");

                //    int hours = 0;
                //    if (isDay == 0)
                //        hours = date.Hour;
                //    else
                //        hours = 24;

                //    for (int i = 0; i < hours; i++)
                //    {
                //        sp.Append("<tr>");
                //        if (i != 23)
                //            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                //        else
                //            sp.Append("<td colspan='2' align='center'>24:00</td>");

                //        for (int k = 1; k < dv.Length; k++)
                //        {
                //            string[] str = dv[k].Split(',');
                //            string value = dv[k].Split(',')[i];
                //            sp.AppendFormat("<td>{0}</td>", value);
                //        }
                //        sp.Append("</tr>");
                //    }
                //    sp.Append("</table>");

                //    #region 导出Excel
                //    if (toExcel == "no")
                //        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX'>");
                //    else
                //        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX1'>");
                //    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='14'>" + repName + "</td></tr>");

                //    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='2'>时间</td><td>名称</td>");
                //    for (int i = 1; i < zb.Length; i++)
                //    {
                //        sp.AppendFormat("<td>{0}</td>", zb[i]);
                //    }
                //    sp.Append("</tr>");


                //    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                //    for (int i = 1; i < un.Length; i++)
                //    {
                //        sp.AppendFormat("<td>{0}</td>", un[i]);
                //    }
                //    sp.Append("</tr>");

                //    if (isDay == 0)
                //        hours = date.Hour;
                //    else
                //        hours = 24;
                //    for (int i = 0; i < hours; i++)
                //    {
                //        sp.Append("<tr>");
                //        if (i != 23)
                //            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                //        else
                //            sp.Append("<td colspan='2' align='center'>24:00</td>");


                //        for (int k = 1; k < dv.Length; k++)
                //        {
                //            string[] str = dv[k].Split(',');
                //            string value = dv[k].Split(',')[i];
                //            sp.AppendFormat("<td>{0}</td>", value);
                //        }
                //        sp.Append("</tr>");
                //    }
                //    sp.Append("</table>");
                //    #endregion
                //}
                //else if (repName == "汽机主要参数日报表")
                //{
                //    if (toExcel == "yes")
                //        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX'>");
                //    else
                //        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' cellpadding='1' id='CX1'>");
                //    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='17'>" + repName + "</td></tr>");

                //    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='3'>时间</td><td rowspan='2'>名称</td>");

                //    for (int i = 1; i < zb.Length; i++)
                //    {
                //        if (i >= 9 && i < 12)
                //        {
                //            continue;
                //        }
                //        else if (i == 12)
                //        {
                //            sp.Append("<td colspan='2'>循环进水温度</td><td colspan='2'>循环出水温度</td>");
                //        }
                //        else
                //        {
                //            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                //        }
                //    }
                //    sp.Append("</tr>");

                //    sp.Append("<tr bgcolor='#CFE6FC'>");
                //    for (int i = 1; i < zb.Length; i++)
                //    {
                //        if (i >= 9 && i <= 12)
                //            sp.AppendFormat("<td>{0}</td>", zb[i]);
                //    }
                //    sp.Append("</tr>");

                //    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                //    for (int i = 1; i < un.Length; i++)
                //    {
                //        sp.AppendFormat("<td>{0}</td>", un[i]);
                //    }
                //    sp.Append("</tr>");



                //    int hours = 0;
                //    if (isDay == 0)
                //        hours = date.Hour;
                //    else
                //        hours = 24;

                //    for (int i = 0; i < hours; i++)
                //    {
                //        sp.Append("<tr>");
                //        if (i != 23)
                //            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                //        else
                //            sp.Append("<td colspan='2' align='center'>24:00</td>");

                //        for (int k = 1; k < dv.Length; k++)
                //        {
                //            string[] str = dv[k].Split(',');
                //            string value = dv[k].Split(',')[i];
                //            sp.AppendFormat("<td>{0}</td>", value);
                //        }
                //        sp.Append("</tr>");
                //    }
                //    sp.Append("</table>");

                //    #region 导出Excel
                //    if (toExcel == "no")
                //        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX'>");
                //    else
                //        sp.Append("<table border='1' width='90%' bordercolorlight='999999' bordercolordark='#FFFFFF' cellspacing='0' style='display:none;' cellpadding='1' id='CX1'>");
                //    sp.Append("<tr bgcolor='#CFE6FC'><td colspan='17'>" + repName + "</td></tr>");

                //    sp.Append("<tr bgcolor='#CFE6FC'><td rowspan='3'>时间</td><td rowspan='2'>名称</td>");
                //    for (int i = 1; i < zb.Length; i++)
                //    {
                //        if (i >= 9 && i < 12)
                //        {
                //            continue;
                //        }
                //        else if (i == 12)
                //        {
                //            sp.Append("<td colspan='2'>循环进水温度</td><td colspan='2'>循环出水温度</td>");
                //        }
                //        else
                //        {
                //            sp.AppendFormat("<td rowspan='2'>{0}</td>", zb[i]);
                //        }
                //    }
                //    sp.Append("</tr>");

                //    sp.Append("<tr bgcolor='#CFE6FC'>");
                //    for (int i = 1; i < zb.Length; i++)
                //    {
                //        if (i >= 9 && i <= 12)
                //            sp.AppendFormat("<td>{0}</td>", zb[i]);
                //    }
                //    sp.Append("</tr>");

                //    sp.Append("<tr bgcolor='#CFE6FC'><td>单位</td>");
                //    for (int i = 1; i < un.Length; i++)
                //    {
                //        sp.AppendFormat("<td>{0}</td>", un[i]);
                //    }
                //    sp.Append("</tr>");

                //    if (isDay == 0)
                //        hours = date.Hour;
                //    else
                //        hours = 24;

                //    for (int i = 0; i < hours; i++)
                //    {
                //        sp.Append("<tr>");
                //        if (i != 23)
                //            sp.Append("<td colspan='2' align='center'>" + (i + 1) + ":00</td>");
                //        else
                //            sp.Append("<td colspan='2' align='center'>24:00</td>");

                //        for (int k = 1; k < dv.Length; k++)
                //        {
                //            string[] str = dv[k].Split(',');
                //            string value = dv[k].Split(',')[i];
                //            sp.AppendFormat("<td>{0}</td>", value);
                //        }
                //        sp.Append("</tr>");
                //    }
                //    sp.Append("</table>");
                //    #endregion
                //}
                //else if (repName == "锅炉主要参数日报表")
                //{

                //}
                ////else if (repName == "")
                ////{

                ////}
                ////else if (repName == "")
                ////{

                ////}
                //#endregion
            }
            else
            { sp.Append("没有查询到结果..."); return sb.ToString(); }



            return sp.ToString();
        }

        /// <summary>
        /// 日报(机组轮转)
        /// </summary>
        /// <param name="repName"></param>
        /// <param name="date"></param>
        /// <returns></returns>
        public string RetTableByDayYZ(string repName, string repType, DateTime date)
        {
            string[] arr;
            string qsrq;
            string jsrq;
            string tjxsA;
            string tjxsB;

            bool isTure = false;

            DateTime dtNow = DateTime.Now;

            this.init();

            if (date < dtNow && date >= Convert.ToDateTime(xzTime))
            {
                if (dtNow.Year == date.Year && dtNow.Month == date.Month && dtNow.Day == date.Day)
                {
                    qsrq = date.ToString("yyyy-MM-dd 00:00:00");
                    jsrq = dtNow.AddHours(-1).ToString("yyyy-MM-dd H:00:00");
                    isTure = true;
                }
                else
                {
                    qsrq = date.ToString("yyyy-MM-dd H:mm:ss");
                    jsrq = date.AddDays(+1).ToString("yyyy-MM-dd H:mm:ss");
                }
            }
            else
            { sb.Append("请输入正确的日期进行查询......"); return sb.ToString(); }

            if (repType == "日报")
            { repType = "日点"; }

            tjxsA = um.tjxs(qsrq, jsrq, 1);
            tjxsB = um.tjxs(qsrq, jsrq, 2);

            list = drp.RetArrsRepDay(repName, repType, qsrq, jsrq, isTure);

            DataTable dtXZ = dr.RetTableXZ("1", repName);

            string[] zb = (string[])list[0];//指标名称
            string[] un = (string[])list[1];//单位
            string[] lay = (string[])list[2];//设计值
            string[] dv = (string[])list[3];//值
            string[] dvExcel = (string[])list[4];//原始值

            if (list.Count > 0)
            {
                if (toExcel == "yes")
                    sb.Append("<table width=\"90%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX\">");
                else
                    sb.Append("<table width=\"90%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX1\">");

                sb.Append("<tr style=\"width: 80%;\" bgcolor=\"#CFE6FC\"> ");
                sb.Append("<td colspan='2' rowspan='2' style=\"width: 20%;\"><div align=\"center\">项  目</td>");
                sb.Append("<td rowspan='2' style=\"width: 10%;\"><div align=\"center\">单  位</td>");
                sb.Append("<td rowspan='2' style=\"width: 10%;\"><div align=\"center\">1#机组</td>");
                sb.Append("<td rowspan='2' style=\"width: 10%;\"><div align=\"center\">2#机组</td>");
                sb.Append("<td rowspan='2' style=\"width: 10%;\"><div align=\"center\">3#机组</td>");
                sb.Append("<td rowspan='2' style=\"width: 10%;\"><div align=\"center\">日累计</td>");
                sb.Append("<td colspan='2' style=\"width: 10%;\"><div align=\"center\">月累计</td>");
                sb.Append("</tr>");
                sb.Append("<tr><td>计划</td><td>完成</td></tr>");

                for (int i = 1; i < zb.Length; i++)
                {
                    sb.Append("<tr>");

                    sb.AppendFormat("<td colspan='2' align='center'>{0}</td>", zb[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", un[i]);

                    //sb.AppendFormat("<td align='center'>{0}</td>", lay[i]);

                    if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "累计" || dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                    {
                        if (dv[i] != null)
                        {
                            if (dv[i].TrimEnd(',').Contains(','))
                            {
                                arr = dv[i].Split(',');

                                for (int j = 0; j < arr.Length - 1; j++)
                                {
                                    if (arr[j] != null)
                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                }
                            }
                        }
                    }
                    else
                    {
                        if (dv[i] != null)
                        {
                            if (dv[i].TrimEnd(',').Contains(','))
                            {
                                arr = dv[i].Split(',');

                                for (int j = 0; j < arr.Length - 1; j++)
                                {
                                    if (arr[j] != null)
                                    {
                                        if (i <= 10)
                                        { sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString()); }
                                        else
                                        {
                                            if (j == 0)
                                            {
                                                if (tjxsA == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else if (j == 1)
                                            {
                                                if (tjxsB == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        }
                                    }
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                }
                            }
                        }

                        sb.Append("</tr>");
                    }
                }

                sb.Append("</table>");

                #region 导出Excel表
                if (toExcel == "no")
                    sb.Append("<table width=\"90%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX\" style=\"display:none;\">");
                else
                    sb.Append("<table width=\"90%\" border=\"1\" align=\"center\" class=\"bg\" valign=\"top\" bordercolorlight=\"#999999\" bordercolordark=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"1\" id=\"CX1\" style=\"display:none;\">");

                sb.Append("<tr style=\"width: 80%;\" bgcolor=\"#CFE6FC\"> ");
                sb.Append("<td style=\"width: 20%;\"><div align=\"center\">指 标 名 称</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">单 位</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">设计值</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">#1机</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">#2机</td>");
                sb.Append("<td style=\"width: 10%;\"><div align=\"center\">全厂</td>");
                sb.Append("</tr>");

                for (int i = 1; i < zb.Length; i++)
                {
                    sb.Append("<tr>");

                    sb.AppendFormat("<td align='center'>{0}</td>", zb[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", un[i]);

                    sb.AppendFormat("<td align='center'>{0}</td>", lay[i]);

                    if (dtXZ.Rows[i - 1]["参数类型"].ToString() == "累计" || dtXZ.Rows[i - 1]["参数类型"].ToString() == "电量")
                    {
                        if (dvExcel[i] != null)
                        {
                            if (dvExcel[i].TrimEnd(',').Contains(','))
                            {
                                arr = dvExcel[i].Split(',');

                                for (int j = 0; j < arr.Length - 1; j++)
                                {
                                    if (arr[j] != null)
                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                    else
                                        sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                }
                            }
                        }
                    }
                    else
                    {
                        if (repName == "厂用电报表")
                        {
                            if (dvExcel[i] != null)
                            {
                                if (dvExcel[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcel[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                            sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }
                        }
                        else if (repName == "汽机报表" || repName == "锅炉报表")
                        {
                            if (dvExcel[i] != null)
                            {
                                if (dvExcel[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcel[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (j == 0)
                                            {
                                                if (tjxsA == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else if (j == 1)
                                            {
                                                if (tjxsB == "0")
                                                    sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                            else
                                                sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (dvExcel[i] != null)
                            {
                                if (dvExcel[i].TrimEnd(',').Contains(','))
                                {
                                    arr = dvExcel[i].Split(',');

                                    for (int j = 0; j < arr.Length - 1; j++)
                                    {
                                        if (arr[j] != null)
                                        {
                                            if (i <= 10)
                                            { sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString()); }
                                            else
                                            {
                                                if (j == 0)
                                                {
                                                    if (tjxsA == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else if (j == 1)
                                                {
                                                    if (tjxsB == "0")
                                                        sb.AppendFormat("<td align='center'>{0}</td>", "0");
                                                    else
                                                        sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                                }
                                                else
                                                    sb.AppendFormat("<td align='center'>{0}</td>", arr[j].ToString());
                                            }
                                        }
                                        else
                                            sb.AppendFormat("<td align='center'>{0}</td>", "&nbsp;");
                                    }
                                }
                            }
                        }
                        sb.Append("</tr>");
                    }
                }

                sb.Append("</table>");
                #endregion
            }
            else
            { sb.Append("没有查询到结果..."); return sb.ToString(); }

            return sb.ToString();
        }
    }
}
